'Select everything expect a word with spaces using regex without multiline
I try to filter a text with a regex. The program I use can only replace text with a regex pattern. So I have to generate a regex that will select everything except a specific pattern/word with spaces and I will replace it with nothing (empty). Unfortunately, the program only uses regex without the multiline option
Goal:
- filter a text to get specific words
My limitations:
- only regex with replace available
- no multiline
Example Text:
ABC 11
ABC 1/10
ABC 1/20
ABC 1/20
ABC 2/10
ABC 2/20
ABC 2/30
ABC 2/40
FULLTEXT
Other Full Text
I want to select everything expect:
ABC 11
ABC 2/10
ABC 2/20
ABC 2/30
ABC 2/40
The pattern with multiline looks like this:
/^((?!ABC 11|ABC 2\/[0-9][0-9]).)*$/gm
https://regex101.com/r/l2zvMX/1
But I search for one without the "/gm". Only "/g"
Best regards, ElGammler
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
