pip9ball has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I'm in need of some regular expression help.
I'd like to create a regular expression that would match the following strings:
<*2>H<3:0>,<*2>I<3:0>,...,<*2>Z<2:0>
H<3:0>,<*2>I<3:0>,...,<*2>Z<2:0>
So the <*K> is optional in each string and there could be numerous tokens (seperated by commas).
I have the following:
<*K>A<N:M>,<*K>B<N:M>
and not
A<N:M>,<*K>B<N:M>.
Is such a regular expression possible?
Thanks!
I'd like to create a regular expression that would match the following strings:
<*2>H<3:0>,<*2>I<3:0>,...,<*2>Z<2:0>
H<3:0>,<*2>I<3:0>,...,<*2>Z<2:0>
So the <*K> is optional in each string and there could be numerous tokens (seperated by commas).
I have the following:
but this will only match$str =~ /<\*\d+>([^<]+)<(\d+):(\d+)>,<\*\d+>([^<]+)<(\d+):(\d+)>/
<*K>A<N:M>,<*K>B<N:M>
and not
A<N:M>,<*K>B<N:M>.
Is such a regular expression possible?
Thanks!
Back to
Seekers of Perl Wisdom