Re: Regular Expressions


Subject: Re: Regular Expressions
amv@akvalentine.com
Date: Mon Jan 05 2004 - 16:29:29 AKST


If it does indeed work like perl, this should work:
/\[img:.{10}\]/

Where the . means any character, and the {10} means the previous character
exactly 10 times.

> I am having a heck of a time trying to figure out the format of regular
> expressions. Particularly I am using the PHP feature preg_replace().
> What I need to do is replace "[img:??????????]" with "<img src=". The
> problem is the "??????????", which stands for 10 characters that I do
> not know and simply need to discard.
>
> Whenever I add anything beyond the following:
> preg_replace("/\[img:/","<img src='",$post_text);
>
> I get an "Unknown Modifier" error for anything that I do. The above will
> replae the obvious "[img:" but those 10 random characters got me stuck.
> Whenever I try to look it up online I constantly get sites that have
> just copied the PHP Manual that doesn't even explain how to use the
> commands very well. I would be very grateful If anyone can help or point
> me in the right direction. As a last note, preg_replace is supposed to
> follow the same rules as Perl.
>
>
> Brian ThunderEagle
> thundereagle@hotmail.com
>
>
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>
>
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Mon Jan 05 2004 - 16:29:35 AKST