Atom search regex negative lookbehind


#1

Hi, I was surprised to see that my Regex with a negative lookbehind didn’t give any results in Atom search.

An example, trying to find the string “/Icon” that is not preceeded by “components”:
(?<!components)\/Icon

I have regex enabled. Is this something that is not supported?


#2

#3

I prefer using Notepad++ for regular expression searches.

Would something like this help you to overcome Javascript’s limitations in Atom?
(?=\w+/Icon)\b(?!components)(.*)(/Icon)


#4

Lookbehinds are now in stage 4, meaning they will be part of ES2018. Until then, this flag should allow you to use them today:

atom --js-flags="--harmony_regexp_lookbehind"

Related:


#5

This is very interesting! I can confirm that it does work.
image

Please, where can we found out more about flags that is available for Javascript that would work in Atom like this? Just for academical purposes.


#6

The flags are likely the same as for chrome and electron.


#7

node --v8-options


#8

Thank you.

In my case I do not have node installed separately.

In Windows the command for my case is:
"%localappdata%\atom\app-1.28.2\resources\app\apm\bin\node.exe" --v8-options


#9

Hi Benjamin,

How does one trigger Chrome flags in/for Atom?
Is Chrome not ‘frozen’ within Electron?

I ask because of the changes that were done to the colouring rendering, there was the option to trigger a Chrome flag to disable the feature. I understood that flag in Chrome could not be reached.

Just academical curiosity - thank you.


#10

No idea. I guess you can’t acces all the chrome flags then. This document seems to list all the ons you can:


#11

Thank you, this will do!