Need hel with Regular Expressions.

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
blue
Forum Newbie
Posts: 5
Joined: Wed May 27, 2009 9:46 pm

Need hel with Regular Expressions.

Post by blue »

I am unable to figure out the regex for the following format:

it begins with {
ends with }
in between we can have alphabets, numbers and _

eg. {name_1}

I know its very basic, but I just can't get it right.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Need hel with Regular Expressions.

Post by requinix »

Code: Select all

/\{(\w+)\}/
Goes into one of the preg_* functions.
Post Reply