REPLACE gives unexpected result; Atom vs Notepad++


#1

Hello.

Does someone still have an older version (V1.18) of Atom installed?
Please could you test the following in FIND-REPLACE:
image

The expected result should be ->

Before:

one
two
three

After:

wordOne
wordTwo
wordThree

For some reason I am under the impression that the above result was possible from an earlier Atom version.


Currently I am having an issue with Atom V1.20.0 (Windows7) not giving the result I was expecting. See below the result. The top part is the result in Atom, while below the result in Notepad++.

Comments are welcome.
Cheers.


UPDATE 1:
image
The case sensitivity setting does not help for this “issue”.


UPDATE 2:
There is another text editor that agrees with Atom’s result:


I am however of the opinion that the FIND-REPLACE functionality should be that of Notepad++. However there are differences in RegEx engines. :frowning:


#2

I’m pretty sure that this should have never worked in Atom. Reason being that the regex flavor that find-and-replace uses is JavaScript. And if you ever find yourself asking “Do JavaScript regexes support…”, the answer is almost always a “no”. In addition, \u generally denotes a unicode character class. So I’m not sure what flavor NP++ is using, but that syntax probably will never be available in Atom.


#3

Thank you for your reply. It must be my mistake then.

Unfortunate though… I use the following in Notepad++ regularly:

  • \u - next characters as uppercase
  • \l - next characters as lowercase
  • \U - all following characters as uppercase
  • \L - all following characters as lowercase

It is handy to convert words to variable names
in style prefix + PascalCaseWords.
For example: dinObjectCounter1

Okay… I will keep Notepad++ installed for now.


#4

RegExp in JavaScript have always been a little… different. If I remember correctly, RegExp will greatly improve in ES2018 :crossed_fingers:t3:

Update: I wasn‘t able to find support for \u, \l etc. in the ES2018 specs


#5

Thank you.