正規表式示
2013-08-26 11:52
$string =~ m/$patten/ $string =~ m{$patten} $string =~ m|$patten| $string =~ m!$patten! $string =~ /$patten/
my $answer = "monger"; until ((my $patten =
my $answer = "mo*r"; # 使用量詞 while (1) { # 所以其實是無限迴圈 if ((my $patten =) =~ /$answer/) { # 判斷是否比對成功 print "*match*\n"; } else { print "*not match*\n"; } };
my $answer = "mo{2,4}r"; # 新的比對樣式 while (1) { if ((my $patten =) =~ /$answer/) { print "*match*\n"; } else { print "*not match*\n"; } };
my $answer = "(wow)+"; # 新的比對樣式 while (1) { if ((my $patten =) =~ /$answer/) { print "*match*\n"; } else { print "*not match*\n"; } };