in reply to Re: Re^2: Creating regex from arrays (oops)
in thread Creating regex from arrays
I think you'll slap your forehead for this one. (:
Does any monk have an idea why [...] the initial pipe needs to be escaped as well
For the same reason that you realized that you needed to do some escaping in the first place. /|/ matches "either the empty string or the empty string" while /\|/ and /[|]/ match a single vertical bar character.
So s#|#\\|#g replaces every empty substring of a string with '\|'.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^4: Creating regex from arrays (oops)
by liz (Monsignor) on Jul 30, 2003 at 07:22 UTC |