in reply to Regular Expression Assistance
Where $string is the string contaning the filename to be extracted, $root is the known bit of the filename and $ext is the file extension. The regex matches $root followed by one or more digits followed by $ext. The x on the end of the regex means that spaces in the pattern don't do anything (except make it more readable).my $root = "/home/monks/thanksforhelping"; my $ext = ".ext"; $string =~ /($root \d+ $ext)/x; my $filename = $1;
|
|---|