Perl,
pasted
on Nov 16:
|
|
use strict;
my @str = (
'S1,F2 title including several white spaces (abbr) single,Here<->There,reply',
'S1,F2 title including several white spaces (abbr) single,Here<->There',
'S1,F2 title including several white spaces (abbr) single,Here<->There,[reply]'
);
foreach(@str) {
print "Input: $_\n";
if(/^S(\d),F(\d)\s+(.*?)\((.*?)\)\s+(.*?),(.*?)(?:,(.*))?$/) {
print "\t$1\n";
print "\t$2\n";
print "\t$3\n";
print "\t$4\n";
print "\t$5\n";
print "\t$6\n";
print "\t$7\n";
}
}
|
Output:
|
|
Input: S1,F2 title including several white spaces (abbr) single,Here<->There,reply
1
2
title including several white spaces
abbr
single
Here<->There
reply
Input: S1,F2 title including several white spaces (abbr) single,Here<->There
1
2
title including several white spaces
abbr
single
Here<->There
Input: S1,F2 title including several white spaces (abbr) single,Here<->There,[reply]
1
2
title including several white spaces
abbr
single
Here<->There
[reply]
|
|