perl regex modifiers
Alex Rice
alrice at ARCplanning.com
Thu Jul 24 07:01:01 EDT 2003
On Thursday, July 24, 2003, at 09:23 AM, Dar Scott wrote:
> The only modifiers at the page I mentioned are ismx. (I use i but use
> methods where the others do not apply.) Maybe the work of g can be
> done with some combination of those?
Actually the "g" modified is mentioned on that page (towards the
bottom) It's meaning in Perl is "globally find all matches". It matches
as many times as it can, which is especially relevant in an
substitution context.
transcript's replaceText() works on all matches by default, which is
why it doesn't need to understand "g" modifier, I am guessing.
In _Programming Perl_ p.150
i,s,m,x,o are pattern modifiers (apply to the regex)
g,cg are are pattern modifiers (change the behavior of the match
operation itself)
Matching Modifiers (m//)
i - ignore alphabetic case
m - let ^ and $ and match next to embedded newline
s - let . match newline and ignore deprecated $* variable (match
multiple things)
x - ignore whitespace and permit comments in pattern
o - compile pattern once only
g - globally find all matches
cg - allow continued search after failed /g match
Substitution Modifiers (s//)
i,m,s,x,o,g (same as above)
e - evaluate the right side as an expression
There are also some modifiers for Translation (tr//)
> I would guess that Revolution regex is based on some library and there
> might be better docs for that.
That would be good know. I am guessing there is a C library called PCRE
and that's what is used in RR.
Alex Rice, Software Developer
Architectural Research Consultants, Inc.
http://ARCplanning.com
More information about the use-livecode
mailing list