Invert regex match
0
1
Entering edit mode
5 weeks ago
vpsev3 ▴ 10

Hello,

I would like to invert my regex match

Example:

sssd;RS=93298723;f

My current regex :

RS=\d*

This regex would match RS=93298723, I would want to invert the match, see demo here https://regex101.com/r/PGkwA5/1

Thank you.

regex • 709 views
ADD COMMENT
0
Entering edit mode

for which tool ? what is "invert" a regex result ? RS=A would "invert" the result..

ADD REPLY
0
Entering edit mode

I edited my question

I'm trying to invert my regex match, for example, I would like to match everything except RS=93298723 (the digits could change)

This is because I'm creating a CSV file with variants to compare them, I will create my own tool in python

ADD REPLY
0
Entering edit mode

aren't you looking for grep -v -f patterns.txt ?

ADD REPLY
0
Entering edit mode

I'm on EmEditor, I try to select everything except RS=(numbers)

ADD REPLY
0
Entering edit mode

I have this regex101.com/r/PGkwA5/1

But I would like to do the opposite

ADD REPLY
0
Entering edit mode

In Python, you can try this (?!RS=\d+)

This is a negative lookahead assertion.

ADD REPLY
0
Entering edit mode

I would need to do this on Emeditor or another text editor

ADD REPLY
0
Entering edit mode

I found !

([^0-9-RS=]+)

edit: well, it finally doesn't works

ADD REPLY
0
Entering edit mode

does anyone have a solution?

ADD REPLY
0
Entering edit mode

I'm still stuck

ADD REPLY
0
Entering edit mode

Please only add an answer to the post if it's a solution to the question. Otherwise you can add it as a comment.

ADD REPLY
0
Entering edit mode

It doesn't works

ADD REPLY
0
Entering edit mode

in Notepad++, try ^((?!RS=93298723).)*$. please post example data. Post is not clear with current example data.

ADD REPLY

Login before adding your answer.

Traffic: 1660 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6