Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Regex matching

by Sifmole (Chaplain)
on Jul 03, 2002 at 12:27 UTC ( [id://179133]=note: print w/replies, xml ) Need Help??


in reply to Regex matching

What sort of return are you expecting? You should also check out the split command, it may be more appropriate here than a regex.

I "know" why you are not getting all the matches, and only the penultimate character block, but I can't seem to explain it right and don't want to misspeak. Hopefully someone else will properly explain that.

You regex can be improved as well
You can use \d instead of [0-9]
You have the / listed twice in your set.
There is no need for a set because your pattern is number followed by slash followed by space.
The reason you don't match out to the last item is because the last item does not have the trailing space. Perhaps you want to match space, number, slash instead.
Is it important that you get between 4 and 27 such blocks? What happens if the line has 29 of them? If it is not important then you don't need the {4,27} and can just use +.
Why are you using case-insensitive matching? Is the initial UFOFH possibly in mixed or lower case? If not, then the i is just slowing you down.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://179133]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-23 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found