I need to add ; at the end of every line that does not end with :
, {
, }
or )
.
I'm using this in Notepad++:
[^:\{\}\)]$
\1;
It finds the strings all right but it replaces the last character found before the end of line with ;
instead of adding it to it. I tried $1
instead of \1
but it didn't change anything — the found text still gets deleted.
Your pattern has no capturing group, hence \1
is an empty string. Use $0
instead to refer to the whole match:
Find What: [^:{})]$
Replace with: $0;
However, it might fail in some edge cases (the [^:{})]$
pattern matches any char other than :
, {
, }
and )
, so requires at least 1 char before a line end), perhaps, you should better use a negative lookbehind here:
Find What: $(?<![:{})])
Replace with: ;
The $(?<![:{})])
pattern matches the end of line (with $
) and then the (?<![:{})])
negative lookbehind makes sure that there is no :
, {
, }
or )
immediately to the left of the current location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With