Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: non-exact regexp matches

by vinforget (Beadle)
on Jun 23, 2004 at 15:12 UTC ( #369063=note: print w/ replies, xml ) Need Help??


in reply to Re^3: non-exact regexp matches
in thread non-exact regexp matches

cool. This seems like a generalized way to go about it. Hope the performance is ok. I need to compare a 27 character reg-exp to a 1 million character string ! vince


Comment on Re^4: non-exact regexp matches
Re^5: non-exact regexp matches
by McMahon (Chaplain) on Jun 23, 2004 at 15:16 UTC
    Reply here when you do it, if you don't mind, I'm interested. I've only ever used List::Compare against arrays with a few thousand elements. Performance was quite acceptable under those conditions. .
      ok. Thanks again.
      Vince
Re: non-exact regexp matches
by Abigail-II (Bishop) on Jun 23, 2004 at 15:19 UTC
    You are talking about regexes, but your example shows the most trivial regex one can image, namely one that doesn't contain any characters that are special. Do you want to match any possible regex, or are you just looking for matching strings? The latter is far, far more easier than the former - and the latter doesn't need the regex engine at all.

    Abigail

      Optimally, I want to match any regexp, but I am not sure if regexps in perl can handle this in a stable fashion. I've been using regexp to report all nested pattern matches with positions of matches using $-[0]:
      m/(regexp)(?{ print $-[0] )(?!)/;

      but everywhere I look most people say to stay away from this stuff because:
      1) it is not stable
      2) it may not be supported in newer versions of perl.
      So I'm not sure if I should take a more specific yet stable approach, or a generalisable yet potentialy unstable approach.
        I don't see the connection between using the (?{ }) and (?!) to report all matches and your original question of finding "partial" matches.

        But so, you want any regexp to match fuzzy. However, then your example is unclear - it's picking out positions in the regex (not in the string) to indicate where characters should be changed. Do you also want to be able to change special characters? Is it ok to introduce characters in the regex to make it match? (That would be easy, just add a | as the first character in the regex).

        Abigail

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2014-09-17 01:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (55 votes), past polls