Answer the question
In order to leave comments, you need to log in
Regular expression to remove spaces at the beginning/end of words?
How to compose a regular expression so that spaces are removed at the beginning of the line before the word (_word), at the end of the line after the word (word_) and replace double or more spaces between two words (word_word) with a single one.
Detailed example:
Source string (_word1_word2__word3_)
String that is needed as a result (word1_word2_word3)
Answer the question
In order to leave comments, you need to log in
You do not need regular expressions for this, there is an excellent trim function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question