Page 1 of 1

# or / in preg

Posted: Sun Apr 16, 2006 1:34 pm
by asgerhallas
Hi,

Can anybody tell me what the diffenrence between the begin and end marks # and / is in PREG?
Are they ekvivalent, or is there any reason to use one over the other?

Just wondering, and kind find anything about it in the manual.

/Asger

Posted: Sun Apr 16, 2006 1:37 pm
by feyd
they are equivalent. Perl compatible regex requires that a symbol, any symbol be used as beginning and ending delimiters. I use a hash (#) most often because many of my patterns have slash (/) in them and it's just annoying to escape those all the time.

Posted: Sun Apr 16, 2006 1:42 pm
by asgerhallas
ah nice... thank you!