N
Neil Shadrach
I have a situation where I'd like to specify a list of files ( full paths )
with a perl regular expression as opposed to shell wildcards.
Something like qr!/usr/path[abc]/file[123]|/user/[abc]path/longer/file[456]!
If a list of all files on the machine ( find / -print ) was cheap to get that
would be fine but it isn't since I will want to check the expansion at intervals.
A reasonable compromise would seem to be to allow individual directory or file names
to be regular expressions but for the separators to be fixed.
That is for qr!/usr/path[abc]/file[123]! I could open each directory in turn and pick
out matches. For my first example I'd have to do it as separately
qr!/usr/path[abc]/file[123]! and qr!/user/[abc]path/longer/file[456]!
Is there a better way to do this? I'd really like to be able to use a single regular expression
with no restrictions ( and without the need to split on the directory separator ).
I've looked at File::Find but couldn't see how it could be used for this case.
with a perl regular expression as opposed to shell wildcards.
Something like qr!/usr/path[abc]/file[123]|/user/[abc]path/longer/file[456]!
If a list of all files on the machine ( find / -print ) was cheap to get that
would be fine but it isn't since I will want to check the expansion at intervals.
A reasonable compromise would seem to be to allow individual directory or file names
to be regular expressions but for the separators to be fixed.
That is for qr!/usr/path[abc]/file[123]! I could open each directory in turn and pick
out matches. For my first example I'd have to do it as separately
qr!/usr/path[abc]/file[123]! and qr!/user/[abc]path/longer/file[456]!
Is there a better way to do this? I'd really like to be able to use a single regular expression
with no restrictions ( and without the need to split on the directory separator ).
I've looked at File::Find but couldn't see how it could be used for this case.