Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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.

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2018-06-23 18:49 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.