brian-girko / multiple-highlight

Color-coded highlighter extension to find queries
https://add0n.com/multiple-highlight.html
23 stars 4 forks source link

Negative look-behind? #5

Closed exec228 closed 4 years ago

exec228 commented 4 years ago

Hello! Thanks for this add-on! However, I have a question. How can I highlight "tank" without "anti-tank"? Does this add-on support r:(?<!-)tank ?

brian-girko commented 4 years ago

how about r:[^-]tank

exec228 commented 4 years ago

That's cool roundabout for one symbol [set] :-) Nice for "-tank" in my particular case. Thanks for reminding me about simpler solution :-D However, do you intend into backreferences?

brian-girko commented 4 years ago

I think you mean "Negative Lookbehind", right? It works for me 1

Also backreferencing 2

brian-girko commented 4 years ago

just a reminder to make sure your word separator is space.

exec228 commented 4 years ago

Sorry, you are correct, the word is "look-behind". https://en.wikipedia.org/wiki/Ordnance_QF_17-pounder plenty of both keywords (http://prntscr.com/rmfupm) Formula I have inserted: r:(?<!-)tank Screenshot http://prntscr.com/rmftcw No highlighting? What am I doing wrong?

brian-girko commented 4 years ago

since the color is red it means your browser rejected the regex creation. Check the console for errors. It looks like this is not supported by your browser.

exec228 commented 4 years ago

http://prntscr.com/rmgb89 Hmm... Any chances you know how to fix it? Firefox 74.0 (64-bit), Windows 8.1x64b9600

brian-girko commented 4 years ago

can you run the following code on the browser console:

/(?<!-)tank/.test('anti-tank')
exec228 commented 4 years ago

http://prntscr.com/rmrvp5

brian-girko commented 4 years ago

Seems like it is not yet supported by FF https://stackoverflow.com/questions/49816707/firefox-invalid-regex-group

exec228 commented 4 years ago

Sigh... Any other ways, external regex libs for Fx?

brian-girko commented 4 years ago

I dont think so. It is built into the Gecko engine.

exec228 commented 4 years ago

Alas, must close the question because of a base constraint. Thank you!