PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Aug 22, 2019 3:11 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Wed Jan 05, 2005 7:50 am 
Offline
Forum Contributor

Joined: Tue Jul 27, 2004 6:19 am
Posts: 206


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 11:48 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 12:07 pm 
Offline
DevNet Master

Joined: Tue Jan 20, 2004 12:11 am
Posts: 4897
Location: Leuven, Belgium
your question has already been answered, but you might want to check out this project: too....

if i understand a little, it does (much) more than what you asked for :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 6:32 pm 
Offline
Forum Contributor

Joined: Tue Jul 27, 2004 6:19 am
Posts: 206


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 6:43 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
basics:
(iterate|display) = look for iterate or display
\s*\( any amount of whitespace followed by an opening paren.
([''"]).*?\\5)|\$.*? look for a quoted string symboling or a vague description of a variable.
{1,2} expect 1 to 2 of them
([''"]).*?\\8)|\$.*? look for a quoted string symboling or a vague description of a variable.
\s*\) any amount of whitespace followed by the closing paren of the function call.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 6:47 pm 
Offline
Forum Contributor

Joined: Tue Jul 27, 2004 6:19 am
Posts: 206
I have 2 questions:
what do the numbers 5 and 8 mean in ([''"]).*?\\5)|\$.*? and ([''"]).*?\\8)|\$.*?

and why do you precede them with \\

I notice that you surround your expression with #. Is it custom?
I also saw expressions that are surrounded by '
is there a difference?
do I must surround my regular expressions with # ?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 9:37 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
you have to surround your pattern with a symbol character... any will work. However, some characters are metacharacters for patterns. Although you can use them for patterns, it's often suggested to find a symbol you like that isn't one of them. ^+-*()[]{}=?|!$ are all metacharacters in some form or another. /@# are the most often used that I've seen as pattern start and end markers (surrounding a pattern)

the 5 and 8 are back references to marked segments of the pattern. In both cases they are [''"], but from differing positions. \\5 references the 5th subpattern that's marked for remembering.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group