Thread Defaultpattern bei Matches (4 answers)
Opened by LanX- at 2008-07-25 03:28

LanX-
 2008-07-25 03:28
#112674 #112674
User since
2008-07-15
1000 Artikel
BenutzerIn

user image
ich bin da über was für mich sehr neues gestolpert ...

Quote
If the PATTERN evaluates to the empty string, the last success-
fully matched regular expression is used instead. In this case,
only the "g" and "c" flags on the empty pattern is honoured - the
other flags are taken from the original pattern. If no match has
previously succeeded, this will (silently) act instead as a gen-
uine empty pattern (which will always match). perlop#Regexp_Quote_Like_Operators


Code (perl): (dl )
1
2
3
4
5
6
$\="\n";
print "b" =~ //;        #1
print "a" =~ /a/;       #1
print "a" =~ /b/;
print "b" =~ //;
print "a" =~ //;        #1

man vergleiche Zeile 2 und 5!

Mir fällt jetzt kein sinnvolles Usecase für dieses Feature ein, kann mir jmd da ein Snippet zeigen?

View full thread Defaultpattern bei Matches