> -----Original Message-----
> From: sven [mailto:[EMAIL PROTECTED]
> Sent: 25 July 2003 10:35
> 
> by the way, it's to complicated. the brackets [ and ] are used for
> cha-groups. you can leave them for only one char. so this 
> would be the same:
> "\\n" (you have to escape the backslash with a backslash)

And then we get into the typical
double-quoted-regexp-backslash-proliferation problem -- the above will pass
\n as the regexp, which matches a newline *not* the intended literal \n.  So
now you have to escape the escaped escape, to get:

  "\\\\n"

Which passes \\n as the regexp, which does indeed match a literal \n !

Another way to go is to use single quotes around the regexp, since a
single-quoted string does not interpret \-expressions (except for \', of
course!) -- so this is the same regexp as above:

  '\\n'

I know which I prefer, but YMMV of course!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to