Hey,
I need a regular expression to solve the following problem (links to similar problems is also appreciated, related tutorials etc.):
"__some_words_a_b___" => "__some words a b___"
"____" => "____"
"some___words" => "some words"
So I want underscores between words to be replaced with space and keep leading and trailing underscores. I found this:
^[ \t]+|[ \t]+$
and I guess it most be something like that. I will use it in jQuery, Java (stdlibs) and maybe XSLT.
Addition: The sentences do not necessarily start with underscores or ends with underscores. It is also possible that a sentence ain't containing underscores at all. Multiple underscores should render to multiple spaces
Best regards Lasse Espeholt