[pmwiki-users] Release: GoogleMapsInterface

Patrick R. Michaud pmichaud at pobox.com
Wed Dec 6 13:49:30 CST 2006


On Wed, Dec 06, 2006 at 06:49:19PM +0000, Hans wrote:
> Wednesday, December 6, 2006, 6:45:43 PM, Craige wrote:
> 
> > I tried the expression, and it was unsuccessful on a match. I assumed it
> > wouldn't, as \\s is looking for a literal '\', and a possible 's'. The
> > initial excaping backslash just excapes the \ in the special character,
> > and then looks for 0 or more "s" characters. However, none of the 
> > modifications of it that I thought would be approipiate worked either.
> 
> AFAIK the double escaping of special regex characters is necessary in
> pmwiki markup. I simply take my lead from pmwiki's own use of markup.

Doubling the escape is not always "necessary", it's just a
defensive coding habit that I've adopted over the years.  It
allows me to not have to worry about when PHP will treat backslash
as an escape or as a literal backslash.  So, if I want backslash+'n'
in a string, I always write '\\n' or "\\n" and I'm assured it will
be correct.

PHP is one of the few languages I know where a single backslash
inside of a double-quoted string is sometimes interpreted as
a literal backslash and not an escape.

Pm




More information about the pmwiki-users mailing list