Quote:
Originally Posted by mmholt
Enlighten me, please?
|
Code:
Search for: (\w\.) (?=\w\.)
Replace with: \1
\w is a single word character (like a letter)
\w\. is a single word character followed by a period (the \. means a period, while the dot alone without the escape backslash is a wild card for any character.)
So "(\w\.) " means a single word character followed by a period followed by a space (note the space there).
(?=\w\.) means to only find "a single word character followed by a period followed by a space" if the space is followed by "a single word character followed by a period". The pattern (?= is a positive lookahead assertion. It lets the preceding match only when the following matches, but the lookahead part doesn't "eat up" any of the string.
For example, the regex "Isaac (?=Asimov)" will match "Isaac " only if it’s followed by "Asimov".