Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to match a data structure with a regex. I'm new to regex, but have made a start. The structure consists of 5 character blocks, seperated by spaces. The 1st is always 'UFOFH', then there are a number of blocks containing digits 0-9 and the / character. There are anywhere between 4 to 27 of these blocks. An example with 20 such blocks is below:
UFOFH 33603 01231 /0000 0024/ 1024/ 2025/ 3027/ 4030/ 5025/ 6028/ 7060/ 8081/ 9098/ 0110/ 1107/ 2106/ 3102/ 4080/ 5065/ 6057/ <\p>
I have tried the below, and some varations (the # is the regex seperator):print $mailbox =~ m#UFOFH ([0-9//]{5} ){4,27}#ig;
But this only returns the penultimate charcter block before the newline (eg. '5065/') I have played around with the brackets, finding that this only returns specific bits of the structure (eg. one set of numbers). How do I wite the regex to return the whole structure from the UFOFH all the way to the last 5 character block?
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regex matching
by bronto (Priest) on Jul 03, 2002 at 12:28 UTC | |
Re: Regex matching
by mikeirw (Pilgrim) on Jul 03, 2002 at 12:06 UTC | |
Re: Regex matching
by Ay_Bee (Monk) on Jul 03, 2002 at 13:23 UTC | |
Re: Regex matching
by Aristotle (Chancellor) on Jul 03, 2002 at 13:24 UTC | |
by Anonymous Monk on Jul 03, 2002 at 13:35 UTC | |
Re: Regex matching
by Sifmole (Chaplain) on Jul 03, 2002 at 12:27 UTC | |
Re: Regex matching
by Anonymous Monk on Jul 04, 2002 at 12:39 UTC | |
Re: Regex Matching
by LAI (Hermit) on Jul 04, 2002 at 14:08 UTC |