Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: "Inverse" Pattern Matching

by Anonymous Monk
on Jul 04, 2013 at 20:49 UTC ( #1042521=note: print w/ replies, xml ) Need Help??


in reply to "Inverse" Pattern Matching

How long are the pattern chunks, and could you scan the string piece by piece?

For example, if you simplify your operation into searching for '123456' in a loop, then you could do a reverse regex and search for the string in the pattern (while changing 'x' to '..?')


Comment on Re: "Inverse" Pattern Matching
Re^2: "Inverse" Pattern Matching
by hdb (Parson) on Jul 04, 2013 at 20:59 UTC

    The length of the pattern can be hundreds. The main source of inefficiency when looping is IMHO that every 'x' constitutes a branch in the pattern. If there is only one 'x' it could stand for one character and one has to pick n-1 other characters to create a pattern of the same length as my short string. However, if 'x' stands for two characters one has to pick only n-2 characters. And if every 'x' stands for two choices, the one has 2**k variants if there are k 'x's.



Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-07-31 23:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (255 votes), past polls