in reply to Perl cheat sheet
A few nits with the regex bits (these are common traps, even for experts):
- The regex metacharacter ^ means "start of string", not "start of line" (unless the /m modifier is used)
- The regex metacharacter $ means "end of string", not "end of line" (unless the /m modifier is used)
- . is "any char except \n" or just "not \n" (unless the /s modifier is used)
A few possible additions:
- Regex "start of string" is \A
- Regex "end of string" is \Z
- Regex "absolute end of string (i.e. no trailing \n) is \z
- Another commonly ignored "NEVER" is: /$userinput/
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Perl cheat sheet
by Juerd (Abbot) on Nov 29, 2002 at 23:19 UTC | |
by TheDamian (Vicar) on Dec 02, 2002 at 01:33 UTC | |
by Juerd (Abbot) on Dec 02, 2002 at 07:42 UTC |
In Section
Craft