in reply to Re^4: perl system command
in thread perl system command
... I wanted feed and any words or digits after ...
/d*/ matches zero or more 'd' characters, but does not match "words" (unless they're composed only of 'd' characters) and certainly not decimal digits. Perhaps you want something like /feed[[:alnum:]]*/
Change the match pattern above to just feed* to see the difference.c:\@Work\Perl\monks>perl -wMstrict -le "for my $str (qw( feed feeder feed001 xfeed001x fee fee001 xfeex --fee-- fe xxx 001 )) { print qq{'$str' -> }, $str =~ m{ feed [[:alnum:]]* }xms ? '' : 'NO', ' match'; } " 'feed' -> match 'feeder' -> match 'feed001' -> match 'xfeed001x' -> match 'fee' -> NO match 'fee001' -> NO match 'xfeex' -> NO match '--fee--' -> NO match 'fe' -> NO match 'xxx' -> NO match '001' -> NO match
Give a man a fish: <%-{-{-{-<
|
|---|