Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: diff of two strings

by rgiskard (Hermit)
on Jan 07, 2008 at 19:14 UTC ( #660906=note: print w/ replies, xml ) Need Help??

in reply to diff of two strings

In the spirit of finding a solution (versus an algorithm), have you reviewed CPAN's Text::WordDiff? It appears capable of doing what you'd like. In the authors words:

To diff source code, one is still best off using 
Text::Diff. But if you want to see how a short story 
changed from one version to the next, this module will
 do the job very nicely.

Comment on Re: diff of two strings
Replies are listed 'Best First'.
Re^2: diff of two strings
by flaviusm (Acolyte) on Jan 07, 2008 at 20:36 UTC


    I did not know about Text::WordDiff module, but I just installed it and tried it.

    The module does a great job identifying the differences of the two strings. However, the module seems to be lacking some functionality in regard to my specific problem

    - the result generated by the module is a single string color coded of the combined two strings => I need two strings (original strings) but with new/changed words tagged (see example in original posting).
    - I did not find a functionality in the module to give me an indication if a certain word is new or it just changed its position in the string.

    However, I will take a look in the module's source code, I might get an idea about their algorithm

    Thanks a lot

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2015-11-27 16:01 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (731 votes), past polls