[Melbourne-pm] basic regex - char array vs "pipe brackets"
crshort at gmail.com
Wed Mar 4 20:10:47 PST 2009
Hmm ... I've been proven wrong ... (again!)
I saw this regex in someone else's code (to check validity of an id field)
and decided that it wouldn't work properly, that what they'd meant was
the character array
Luckily I chucked it into Regex Coach and found both of them worked
just as well.
Thing is, when I look at
I automatically assume it will look for repeated occurences of the
first character, as this would:
How should I remember that it doesn't work that way? That the "memory
brackets" only get used where \1 , $1 etc are specifically mentioned?
Turns out the long-term perl developer who wrote that code always uses
"pipe brackets" instead of character arrays.
Do they really function identically?
More information about the Melbourne-pm