[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[OT] - Regex help



<?php
    $str = 'I\'m a text: =match1 =match2=match3=match4 =nomatch{}
=match5=match6';
    //$rex = "/=[A-z]+/"; // works but not exclude =nomatch{}
    $rex = "/=[A-z0-9]+(\s|=)/"; //
    $N = preg_match_all($rex,$str,$out);

    print $N." $str\n";
    print_r($out);
?>

Sorry for OT. I have a little problem with regex above. The script is
in PHP, but regex should be compatible with Perl.

I want match =[A-z0-9] where char after this is \s or =, final = is
the start char of next match. How can go back after first matching?
The result of the script

Array
(
    [0] => Array
        (
            [0] => =match1
            [1] => =match2=
            [2] => =match4
            [3] => =match5=
        )


Can you help me?

-- 
Openclose.it - Idee per il software libero
http://www.openclose.it



Reply to: