Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^4: Problem with capturing all matches with regex

by igoryonya (Pilgrim)
on Oct 13, 2016 at 01:37 UTC ( [id://1173895]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Problem with capturing all matches with regex
in thread Problem with capturing all matches with regex

Yes, I've looked into the perlretut (or something, forgot) section. It said, that it's a new buggy feature.
But, I kind of dreamed of feature like that, because, I have one megapattern, in one of my programs, that I've had to create an entire subroutine for it to parse with many different regexes and ifs thenths, that spans for about 3 screen pages. I was hoping for a feature like this to make that pattern matching subroutine to make more consize.
I think, in that sub's case, I am targetting not the speed, but readability and managedness of the code :)
  • Comment on Re^4: Problem with capturing all matches with regex

Replies are listed 'Best First'.
Re^5: Problem with capturing all matches with regex
by duelafn (Parson) on Oct 13, 2016 at 09:07 UTC

    At that point (three pages of parsing regexps), I think you are well into the territory where you should use a grammar engine. For instance, Parse-RecDescent, or my preferred, Marpa-R2

    Good Day,
        Dean

      Seams, like grammar engine is a cool thing, but I am not getting it.
      I've read descriptions and readmes about both libraries that You've suggested, but the only thing that I can find, is that they are for source code parcing.
      Looked at term "grammar engine" on the inet and on wikipedia. Found nothing useful, and pretty much the same, as what I've said above.
      How is it compared to regex?

        Grammars are for parsing data, not just code (which is a subset of data). For example, see demo_PerlCSV.pl from the Parse::RecDescent demo directory.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found