Rob Coops wrote:
Hi all,
Hello,
I am having some trouble matching the following string:
"Some text+...:...:...:...:...+some more text"
The trick is there are two dilimiters in this string the + and the : are
used to separate the string, the + signifies a part of the string ended and
the : signifies a sub part of the string has ended.
Now I need to match this string according to the following rules.
- Part 1: 0 to 15 alphanumeric characters (Mandatory)
By definition, if it matches 0 characters it is optional. But, be that
is it may:
[[:alnum:]]{0,15}
- Part 2: (Mandatory)
- Sub part 1 0 to 70 alphanumeric characters (Optional)
[[:alnum:]]{0,70}
- Sub part 2 0 to 70 alphanumeric characters (Optional)
[[:alnum:]]{0,70}
- Sub part 3 0 to 70 alphanumeric characters (Optional)
[[:alnum:]]{0,70}
- Sub part 4 0 to 70 alphanumeric characters (Optional)
[[:alnum:]]{0,70}
- Sub part 5 0 to 70 alphanumeric characters (Optional)
[[:alnum:]]{0,70}
- Part 3: 0 to 3 alphanumeric characters (Optional)
[[:alnum:]]{0,3}
I am 100% certain to get all possible variations that these rules allow, so
how do I match this correctly using a single regex?
Need some samples of valid and invalid data to test on.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/