For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > February 2006 > finding and showing difference in 2 strings









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author finding and showing difference in 2 strings
whomikejones

2006-02-28, 6:58 pm

if i have 2 strings lets say the following:

My favorite color is blue
My favorite color is red

how would i go about returning just the part that has changed, in this case "red"

i tried to do this using regex and whatnot but the position of whats changed isnt constant. that same text line could change later as such:

My favorite color is red
Your favorite color is red

in this case i would want to return "Your"

any modules or help would be sweet.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com