Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

[PHP3] Regular ****ing expressions From: Mark Selby (selby_mark <email protected>)
Date: 05/15/00

Hi PHP'ers,

I had a reply earlier but guess it was a php4
function.
In $str, I want to replace any occurances of
'<:$varname:>' with ' $varname ', so I can then
'print("$str");' and see the actual variable values.
I need to be sure it started with '<:$' and ended with
':>'

Thanks in advance.
Mark.

<HTML><H1>Test of Regular Expressions</H1>
<?
        $str = "Hello this <:$somevar:> is a test of
<:$someothervar> regular expressions";

// $result = split("<:$[a-zA-Z0-9\_]{1,}:>"," ",$str);
        $result = split("[<:|:>]",$str);

        for($index = 0; $index < count($result); $index++)
        {
                print("$index. $result[$index],<BR>\n");
        }
?>
</HTML>

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>