Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 06-23-2009, 10:24 AM   #1 (permalink)
samara
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
Display Modes

Posting Rules

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

Points Per Thread View:
Points Per Thread:
Points Per Reply:



» 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 10:04 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums