Writing a globalization module for a web application and I need a regexp to replace all instances of a word with another word (the translation) - except - words found within a URL/URI.
EDIT: I forgot to mention that I'm using Ruby, so I can't use 'Lookbehind'
Code:
Have you tried splitting your text into words and iterating over the words? Then you can examine each word, determine if it's a URI, translate it if it isn't.
You can probaby use something like
But this probably isn't perfect, it just looks that the word doesn't appear in a single non-whitespace string of characters that don't have
://
somewhere before the word.