Re: regular expression help
| From: | Matthew Fonda | Date: | Wed, 29 Sep 2004 05:54:36 +0000 |
| Subject: | Re: regular expression help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198157@lists.php.net to get a copy of this message | ||
Howdy,
Regular expressions are a simple way of matching patters.
You can learn more about regular expressions in general here:
http://www.opengroup.org/onlinepubs/007908799/xbd/re.html
If you are interested in using regular expressions in PHP, check out
these sites:
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
A regex to match what you are looking for would be /\{(.+?)\}/, and then
just replace it without the { and } for the replace part.
On Tue, 2004-09-28 at 22:46, Ed Lazor wrote:
> <complain>
> Today I discovered that my ISP can't upgrade to PHP 5. They use Plesk for
> server Administration and PHP 5 apparently breaks Plesk. Plesk says they'll
> make PHP 5 support available as soon as it starts coming default on RedHat
> Enterprise.
> </complain>
>
> Unfortunately, I now have a bunch of scripts that require PHP 5. I'd
> upgraded my beta server for testing and everything has been going so great
> that I went gungho. Honestly, I tried to not too many of the new features,
> just so I could ease into it and do more testing. I'm finding little
> differences that I didn't even realize I was taking advantage of. For
> example, there are a lot of places in the code where I've done something
> like this:
>
> print "Learn more about {$product->get_Title()}.<br>";
>
> I uploaded scripts like this to the production server for more testing and
> PHP4 flagged all of the code like this as parse errors. I'm not sure, but
> now I'm stuck having to go through all of the code to change the coding
> style.... my editor (Dreamweaver MX 2004) allows me to do a global search
> and replace using regular expressions. I have no idea what regular
> expression I'd use for something like this. Any recommendations?
>
> Thanks,
>
> Ed
>