[Message Prev][Message
Next][Thread Prev][Thread Next][Message
Index][Thread Index]
Re: [OT] Perl Help using split
Quoting Paul Smith (ukha@xxxxxxx):
> I'm trying to automate file renaming and using perl.
>
> {Law & Order}{2005-05-26}{Identity}{10.00 PM Thu May 26,
> 2005}{SKYONE}.ty
>
> This is the example file name and thought I could use the
> split command, but can't work out the pattern match.
>
> What I'm looking for it to extract the information between the {} in
the
> file name.
Not the neatest way, but this works unless you have nested braces:
$s = '{Law & Order}{2005-05-26}{Identity}{10.00 PM Thu May
26,2005}{SKYONE}.ty';
$s =~ /^({.*?})({.*?})({.*?})({.*?})({.*?})/;
print "field1 = $1\n";
print "field2 = $2\n";
print "field3 = $3\n";
print "field4 = $4\n";
print "field5 = $5\n";
James
UKHA_D Main Index |
UKHA_D Thread Index |
UKHA_D Home |
Archives Home
|