Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Growing strings in search

by choroba (Cardinal)
on Apr 15, 2020 at 13:56 UTC ( [id://11115573]=note: print w/replies, xml ) Need Help??


in reply to Growing strings in search

By "growing", do you mean you have variables that contain the strings and their content gets longer over time? Or do you need to read the strings from outside (a file, socket)?

The answer also depends on the regex. For a simple regex, just starting where you left off might be enough (e.g. qr/X/), but even for a bit more complex regex qr/abc/, you can't just continue with the newly added characters, as the original string might have end in "ab" and the new character might be "c" that completes the match. For even more complex regexes like qr/a.*b/ you might need to return unknown number of characters to the left (i.e. to the last "a").

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Growing strings in search
by b4swine (Pilgrim) on Apr 15, 2020 at 15:47 UTC

    The strings are growing because data is coming in from the outside.

    The regexes are so complicated that they are software generated.

    The only other possibility seems to be to try to understand the regex and see if it can be expressed as something simpler, but that sounds too horrible to contemplate.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11115573]
help
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: (4)
As of 2024-04-25 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found