DanH
DanH

Reputation: 5818

Match a space that is not at the end of the line

I'm trying to match all spaces and convert to escaped spaces, but only those which do not occur at the end of a line, so far I've tried /\ !$/\\\ /g to and general button mashing around that point.

Upvotes: 1

Views: 152

Answers (1)

burning_LEGION
burning_LEGION

Reputation: 13460

use this regular expression (?m)( +)(?!$)

(?m) regex option multyLine

( +) > 0 spaces

(?!$) is not end of line

Upvotes: 3

Related Questions