Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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
Re^2: diff of two strings
by flaviusm (Acolyte) on Jan 07, 2008 at 20:36 UTC

    rgiskard,

    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

    Problems:
    - 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-09-16 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (53 votes), past polls