GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Anybody know regex? (https://gfy.com/showthread.php?t=596139)

BigBen 04-09-2006 03:03 PM

Anybody know regex?
 
What's a regular expression that will find all occurences of anything between the following characters: {$ and }

So if I have some text: "The site name is {$site}", I need to match 'site'. It has to be greedy as there may be multiple matches.

Any ideas? Thanks.

J.P. 04-09-2006 03:18 PM

try using this:

/\{\$[^\}]+\}/


BTW:
"greedy regexp" does not have anything to do with multiple matches...

if you would use /\{\$.*\}/ on "hello {$site} and a happy new {$what}"

greedy regexp would match a "{$site} and a happy new {$what}" and the non-greedy one would match a "{$site}" and "{$what}"

BigBen 04-09-2006 03:42 PM

Quote:

Originally Posted by J.P.
try using this:

/\{\$[^\}]+\}/


BTW:
"greedy regexp" does not have anything to do with multiple matches...

if you would use /\{\$.*\}/ on "hello {$site} and a happy new {$what}"

greedy regexp would match a "{$site} and a happy new {$what}" and the non-greedy one would match a "{$site}" and "{$what}"

That works perfect, thanks. :)

J.P. 04-10-2006 09:02 AM

no problem, anytime :)


All times are GMT -7. The time now is 11:40 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123