Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-22-2013, 09:28 AM   PM User | #1
kenshn111
New Coder

 
Join Date: May 2010
Posts: 75
Thanks: 13
Thanked 2 Times in 2 Posts
kenshn111 is an unknown quantity at this point
preg_match_all 2 cases

Heyyy

I was trying to get the text between the '.' and ']' and also the text between the two ":

PHP Code:
$html '[ACCESSORY_IDs.ACCESSORY_GOGGLES] = "_°í±Û"';

preg_match_all('/(s.)(.*?)]/'$html$matchesPREG_SET_ORDER);

foreach (
$matches as $val) {
    echo 
"matched: " $val[0] . "<br>";
    echo 
"part 1: " $val[1] ."<br>";
    echo 
"part 2: " $val[2] ."<br>";
    echo 
"part 3: " $val[3] ."<br>";
    echo 
"part 4: " $val[4] ."<br><br>";

the code outputs
Quote:
matched: s.ACCESSORY_GOGGLES]
part 1: s.
part 2: ACCESSORY_GOGGLES
along with multiple errors but the errors are expected

I tried to look for a tutorial about the patterns but I haven't found any, I guess I was too dumb to find one. :x

can someone help me or teach me please?

Last edited by kenshn111; 02-22-2013 at 09:43 AM.. Reason: turns out I can just use | to have multiple patterns :D
kenshn111 is offline   Reply With Quote
Old 02-22-2013, 10:09 AM   PM User | #2
Arcticwarrio
Regular Coder

 
Arcticwarrio's Avatar
 
Join Date: May 2012
Location: UK
Posts: 574
Thanks: 15
Thanked 64 Times in 64 Posts
Arcticwarrio is on a distinguished road
Try

http://txt2re.com/

is good for that kind of stuff
__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Arcticwarrio is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 02:51 PM.


Advertisement
Log in to turn off these ads.