View previous topic :: View next topic |
Author |
Message |
ssjkakaroto
Joined: 09 Mar 2007 Posts: 17 Location: BR
|
Posted: Fri Mar 09, 2007 8:58 pm Post subject: How to add comments? |
|
|
Hi there. How can I add comments to the search/replace pattern? I saw on one of your examples that you added #comment after it, but it didn't work for me.
Thanks |
|
Back to top |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Sat Mar 10, 2007 3:54 am Post subject: |
|
|
You have to use the regex verbose flag in the search pattern. The verbose flag lets you add a comment at the end and also lets you add whitespace in and around the pattern. The flag is 'x'. Regex flags are placed at the beginning of search patterns inside a pair of parentheses with a question mark after the left parentheses.
i.e. (?<flags>)
For example:
(?x) [0-9]+ # match on number sequence
THe above example adds a comment at the end.
There are other standard regex flags. e.g. 'i' is used to ignore case.
More than one flag can be used at a time.
For example:
(?xi) [AEIOU]+ # match on vowel sequence (ignore case)
The above example adds a comment and also ignores letter case when pattern matching.
PFrank also defines some flag extensions for extra functionality. Complete information about regex flags and the PFrank extensions can be found in the built-in help. |
|
Back to top |
|
 |
|