Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Problem with a text-parsing regex

by ibm1620 (Hermit)
on May 07, 2022 at 21:50 UTC ( [id://11143656]=note: print w/replies, xml ) Need Help??


in reply to Re: Problem with a text-parsing regex
in thread Problem with a text-parsing regex

Thank you -- I think you've nailed it.

I'd never thought about using a character-at-a-time approach as you did to handle the first problem. I just assumed it would be much less efficient than trying to use [[:word:]]+, for example. But there's probably no basis for that assumption. (Premature optimization!) That could make it easier in the future for me to tackle these complicated scenarios.

I use v5.34.1, and will take a look at regex_sets.

Replies are listed 'Best First'.
Re^3: Problem with a text-parsing regex
by hv (Prior) on May 07, 2022 at 23:17 UTC

    I'd never thought about using a character-at-a-time approach as you did to handle the first problem. I just assumed it would be much less efficient than trying to use [[:word:]]+, for example.

    It will be less efficient - but I would always recommend solving the problem first, and worrying about optimization second.

    In the general case, a regular expression that has to invoke more regops (regexp operations) will usually be slower than one that invokes fewer; but the cost will be less than invoking more ops at the perl level.

Log In?
Username:
Password:

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

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

    No recent polls found