Help for this page

Select Code to Download


  1. or download this
    $x="[x=1 y=3 z=5]";
    print join ":", $x=~/(\w+)=(\d+)/g;
    
  2. or download this
    print join ":", $x=~/\G          # start where prev match left off
                         (?:\A\[)?   # if start of string, expect [
    ...
                        /gcx;
    # if whole string was parsed, pos will be defined and equal to length
    print "error" unless pos($x) && pos($x) == length($x);