Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re: Regex matching by Sifmole
in thread Regex matching by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-24 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found