I can get my users to handle wildcards but regexp... no chance. Any suggestions are as always appreciated and perhaps wiser eyes will say that I'm tackling this the wrong way .... ? ThanksHello All, Any ideas how to recreate a dos wildcard filemask of the typ +e "help*.txt" as a string for insertion in a pattern match. At the + moment I'm trying to write a subroutine that returns an escaped stri +ng which I then insert in my m// ... ie $myregex = &my_regex_generator("help*.txt"); if( $mystring =~ /$myregex/i){do stuff.... at the moment I've got - sub gen_convert_wildcards_to_regexp{ my $wildcardstring = $_[0]; my $regex_string = $wildcardstring; $regex_string =~ s/\./\\\./gi; #escape the dots $regex_string =~ s/\*/\\*/gi; #escape the $regex_string = $regex_string . "\\b\$"; return $regex_string; } Which is pretty crap and fails with the * wildcard
In reply to dos file masks and regular expressions by fluffyvoidwarrior
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |