Preg_Match_All ............ format error! - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-23-2009, 09:24 AM   #1 (permalink)
Junior Member
 
Join Date: Jun 2009
Posts: 2
Default Preg_Match_All ............ format error!

Hai need help regarding this one:
I think the problem is with the $pattern2, I am not knowing the format to write it!! Can anyone help me please

This is the code, my task is to pull out the values of the report type stired in the file: They are stored like this:

username ~false./true.report type1~false./true.report type2.......etc

the report type will be added to a file with a false or true before it depending on user selection in previous step.

Code:
$pattern2 = "/^([-\w]{".PERM_TYPE_SEPARATOR."})\s(false.|true.)\s(.*)$/";

if(preg_match_all($pattern2, $entry2, $match))
                {
                    echo "this one is called too";
                for($i = 0; $i < count($match[1]); $i++)
                {
                   echo "This one";
                //if($match[1][$i] == "true.")
                echo $match[2][$i];
                }
                //echo "123";
                    //$metadata[$matches[1][$i]] = $matches[2][$i];
                }
Value of $entry2 at the time of execution

Code:
string '~false.123~false.45678~false.67890~false.123456~false.Hai testing~false.I am good~false.Now this should work~false.Plug'... (length=1223)

This is the result I am getting
Code:
$match =array
        0 => 
        array
          empty
        1 => 
         array
          empty
        2 => 
        array
          empty
        3 => 
         array
           empty

This is the text file I am actually parsong:


admin ~false.123~false.45678~false.67890~false.123456~fa lse.Hai testing~false.I am good~false.Now this should work~false.Second time~false.Test~false.Testing Parsed list~false.Testing reports~false.Testing settings~false.abcd~false.abcdef~false.hai how are you~true.sawraasdagweagsd~true.tested~true.tested2 ~true.testing~true.testing code again~true.testing code again 2~true.testing code now~true.testing it again~true.testing new report~true.third one~false.ujruesszerhqwrqhwer
samara is offline   Reply With Quote
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:43 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting