regularni vyrazy
Frantisek Darena
darena na akela.mendelu.cz
Pondělí Listopad 18 14:39:58 MET 2002
Dobry den, dokaze mi prosim nekdo vysvetlit nasledujici problem?
Pri pouziti kontrukce (?<=VZOR) jsem se docetl, ze VZRO musi mit pevne
zadanou delku. Proto, kdyz bych se pokusil pouzit kvantifikatory, jako je
*, +, {MIN, MAX} apod., ocekaval bych chybu.
perl -e '$s = "xxxabc";print $& if $s =~ /(?<=x*)abc/;'
-----------
Variable length lookbehind not implemented in regex; marked by <-- HERE in
m/(?<=x*)abc <-- HERE / at -e line 1.
perl -e '$s = "xxxabc";print $& if $s =~ /(?<=x{2,4})abc/;'
-----------
Variable length lookbehind not implemented in regex; marked by <-- HERE in
m/(?<=x{2,4})abc <-- HERE / at -e line 1.
perl -e '$s = "xxxabc";print $& if $s =~ /(?<=x{2,})abc/;'
-----------
Variable length lookbehind not implemented in regex; marked by <-- HERE in
m/(?<=x{2,})abc <-- HERE / at -e line 1.
perl -e '$s = "xxxabc";print $& if $s =~ /(?<=x{2})abc/;'
-----------
abc - toto bych pochopil
ale
perl -e '$s = "xxxabc";print $& if $s =~ /(?<=x{,3})abc/;'
^^^^
nevypise vubec nic. Jak je to mozny, kdyz konstrukce {MIN,} je podle me
stejne variabilni jako {,MAX}, nebo jako {MIN,MAX}, kde to ovsem skonci s
chybou.
Dekuji
F. Darena
Další informace o konferenci Perl