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

Re^3: How to use regular expression for this? (LCS)

by tye (Sage)
on Aug 13, 2005 at 02:21 UTC ( #483482=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to use regular expression for this? (LCS)
in thread How to use regular expression for this?

Yes, I chose to interpret the problem as described (N characters "in order" with no mention of position) and to interpret the lining up of the positions as merely a typographic choice to make the correspondence more visually obvious.

There certainly are other ways to interpret the problem and I don't even assert that the interpetation that I chose is the most likely to be correct. (:

If my assumption was correct however, then using Algorithm::Diff::LCSidx to compare the pattern against the target string will work, but requires the additional step of checking to see if the contents of the two arrays of indices pointed to by the returned references are equivalent.

That'd work for the examples given, but could fail for a case like "CCCDDFFIII".

- tye        

  • Comment on Re^3: How to use regular expression for this? (LCS)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2023-02-03 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (25 votes). Check out past polls.

    Notices?