First of all, you might want to put more than one %.... probably like %%%

Reason is, asp users <% %> like php uses <? ?>.

Just a precaution.

You almost had the regex right.

/%[a-z]+%/i

Thans means, starts with a %, can match a-z, at least once (the +
part) but as many times (greedy), then another %, and the i means
case-insensitive. If you don't have that you'd have to do [a-zA-Z]
instead. Also, will there be anything else in there besides just alpha
chars?

-Josh

On Fri, 2 Jul 2004 13:56:29 -0500, George Lantz
<[EMAIL PROTECTED]> wrote:
> 
> Could someone help me with a regular expression? I am not very good at
> them. I want to find the following pattern inside a file:
> 
>  [%string%]
> 
> Then extract the string portion to store in array.  I would next like to
> replace those patterns with html code. That's right you guessed it a
> template engine type program.
> 
> I thought it was"/\[\%[a-z]\%\]" but I guess I am wrong. Then what
> function do I use to extract.
> 
> Thank you,
> George
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to