Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Unable to constrain the effect of a negative lookahead

by Fletch (Bishop)
on Apr 15, 2022 at 13:24 UTC ( [id://11142998]=note: print w/replies, xml ) Need Help??


in reply to Unable to constrain the effect of a negative lookahead

Just an (almost) meta comment: Trying to do something like this with a single regexp is when you may start getting into "Now you have two problems" territory. As has been shown you can do this in one pass with deep regex engine magic, but were I to do it I'd instead break it down into a simple state machine and parse things line-by-line that way instead. And were the "language" being handled much more complicated then I'd look to use a proper parser module (Parse::RecDescent, maybe Marpa::R2) and let that write the state machine. If/when things change about the "language" I just would need to update the higher level grammar description instead of manually monkeying in more states.

The cake is a lie.
The cake is a lie.
The cake is a lie.

  • Comment on Re: Unable to constrain the effect of a negative lookahead

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-23 15:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found