Regex: find / replace all substrings without a given string before?

I need to find all rows without a given row.

For instance:

Find: "someValue"

** All results with "function (" in front of them should be ignored

A Visual Studio regular expression will find this :

value = someValue

And Ignore something like this :

function(someValue)

What is the best way to do this?

Thanks for the help!

+3
source share
2 answers

You can use a negative look:

(?<!function\()someValue
+2
source

you said

A Visual Studio regular expression will find this:

, , - Visual Studio, , .

, , ; Visual Studio , , , , !

, , SilentGhost .NET( PowerShell script) . , Studio , TextPad. , .

, PowerShell , foo.js fooNew.js:

(get-content D:\junk\foo.js) -replace
    '(?<!function\()someValue', 'someOtherValue' > D:\junk\fooNew.js
+2

Source: https://habr.com/ru/post/1742500/


All Articles