-2

I would like to replace all string that do not equal this: readWriteDataGroup="Everyone" on a file I have open in Notepadd++. One of the strings that it will need to replace has this string: readWriteDataGroup="E_MOD_WSP_64"

So I have been doing this manually but there is over 1000000 lines which is not feasible to be done manually.

How can I do this via regex?

4
  • What is your regEx? search key readWriteDataGroup="Everyone", and replace value readWriteDataGroup="E_MOD_WSP_64", why would not this work? Commented Jul 19, 2023 at 8:17
  • 1
    What is a "string that do not equal readWriteDataGroup="Everyone""? What does it mean that "One of the strings [...] has this string"? Commented Jul 19, 2023 at 8:25
  • 1
    Please, edit your question and add example lines from your file and expected result. As is, your question is really unclear. Commented Jul 19, 2023 at 8:59
  • 1
    Also, what have you already tried? Commented Jul 19, 2023 at 9:53

1 Answer 1

1

If you search for (readWriteDataGroup=")(?!Everyone")[^"]*(") and replace it with $1X$2 then all the lines that do not contain Everyone in the quotation marks will be replaced with an X.

How that works:

In the search string

  • (readWriteDataGroup=") will match readWriteDataGroup=" and save it as $1
  • (?!Everyone")[^"]* will match any string that isn't Everyone
  • (") will match a trailing " and save it as $2

In the replacement:

  • $1 is the first capture group (readWriteDataGroup=")
  • X is the replacement text
  • $2 is the second capture group (")

You can try it here: https://regex101.com/r/Bum3HU/2

In Notepad++, make sure you select the "Regular Expression" button on the Replace dialog.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.