in reply to Re: Re: Removing duplicate substrings from a string - is a regex possible?
in thread Removing duplicate substrings from a string - is a regex possible?
I would strongly discourage regexes in this case!! It's a lot trickier than the split/hash solution (and a lot trickier than you think :). Take as an example the solution $data=~s!((.*)/.*/)\2!$1!g; from arhuman which doesn't work correctly even for your first example (NY/Ch/NY), as it leaves a '/' at the end of the string. And much more important it breaks in nearly all other cases. The problems include
-- Hofmator
|
|---|