# or / in preg

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asgerhallas
Forum Commoner
Posts: 80
Joined: Tue Mar 14, 2006 11:11 am
Location: Århus, Denmark

# or / in preg

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
asgerhallas
Forum Commoner
Posts: 80
Joined: Tue Mar 14, 2006 11:11 am
Location: Århus, Denmark

Post by asgerhallas »

ah nice... thank you!
Post Reply