jaacmmason has asked for the wisdom of the Perl Monks concerning the following question:
I have the following line of code in a script:
.Pattern = "(^c|l|j|s|o)\d{4}[_](\d*?.dat|\d*?.idx)"This is being used to delete any files starting with C, L, J, S or O followed by the '_' and 0 or more digits then the extension. My issue is I need to modify this single line to delete all files as stated above AND files that do not have the '_' and 0 or more numbers in it.
Problem is I do not want to delete a files named C1234ABC.IDX. 1 letter, 4 digits, followed by either the extension, or _# or _## then extension. I have been playing around with:
.Pattern = "(^c|l|j|s|o)\d{4}\w*?(\d*?.dat|\d*?.idx)"but this did not do anything at all. Any ideas or suggestions to help resolve this would be great.
Thanks!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Expression Assistance
by toolic (Bishop) on May 17, 2013 at 20:14 UTC | |
|
Re: Regular Expression Assistance
by Laurent_R (Canon) on May 17, 2013 at 20:51 UTC | |
|
Re: Regular Expression Assistance
by frozenwithjoy (Priest) on May 17, 2013 at 22:32 UTC | |
by Laurent_R (Canon) on May 17, 2013 at 22:39 UTC | |
|
Re: Regular Expression Assistance (data?)
by LanX (Saint) on May 17, 2013 at 20:29 UTC | |
|
Re: Regular Expression Assistance
by eye (Chaplain) on May 18, 2013 at 18:40 UTC |