Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: diff of two strings

by rgiskard (Hermit)
on Jan 07, 2008 at 19:14 UTC ( [id://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

    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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://660906]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-03-28 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found