|There's more than one way to do things|
Re: Re: Perl cheat sheetby Juerd (Abbot)
|on Nov 29, 2002 at 23:19 UTC||Need Help??|
* 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)
Because "foo\n" =~ /foo$/, I tend to explain it differently. ^ and $ are begin and end of a line, but /m modifies the meaning of line. $ certainly is not end of string when the string ends in \n. I'm not sure if and how I want to change the sheet.
* . is "any char except \n" or just "not \n" (unless the /s modifier is used)
Good point, will be changed.
regex \A, \Z and \z
Maybe if I need to fill some room in a future version, but I kind of wanted to keep it simple. I also didn't include \G, \X, \C, \b, \B. I think I'd add \b and \C first.
* Another commonly ignored "NEVER" is: /$userinput/
Good one, but I'd need another line :). Will remember it for a future version, though. Update - Added valdez' link suggestion and a use Modules; et voila: a line to put /$userinput/ on!
Thanks for your input!