Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-13-2008, 11:12 AM Regex help
AliKat's Avatar
Extreme Talker

Latest Blog Post:
Save the Children
Posts: 176
Location: MS
Trades: 0
I really hate regex expressions. I am not very good at it at all.

If anyone can help me get the following information from this I would greatly appreciate it

The expression:
Code:
[roll=6]1[/roll]
What I need to parse are:
1. I need to replace the above statement where 6 and 1 can be any number
2. I need to get the number after the equal sign
3. I need to get the number between the two codes.

Any help would be greatly appreciated it.
AliKat is offline
Reply With Quote
View Public Profile Visit AliKat's homepage!
 
 
Register now for full access!
Old 08-13-2008, 11:22 AM Re: Regex help
AliKat's Avatar
Extreme Talker

Latest Blog Post:
Save the Children
Posts: 176
Location: MS
Trades: 0
I got the whole replacement:

Code:
#\[roll=(\d+?)\](\d+?)\[/roll\]#i
AliKat is offline
Reply With Quote
View Public Profile Visit AliKat's homepage!
 
Old 08-13-2008, 11:37 AM Re: Regex help
AliKat's Avatar
Extreme Talker

Latest Blog Post:
Save the Children
Posts: 176
Location: MS
Trades: 0
got the final peices:

PHP Code:
$output preg_split('#\[roll=(\d+?)\](\d+?)\[/roll\]#i',$msg,-1,PREG_SPLIT_DELIM_CAPTURE);
        
$sides $output[1];
        
$times $output[2]; 
AliKat is offline
Reply With Quote
View Public Profile Visit AliKat's homepage!
 
Reply     « Reply to Regex help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11356 seconds with 12 queries