Regex that should exclude matched string | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Regex that should exclude matched string

please help me to write a regex that should exclude the matched pattern.. ex: i have a regex pattern A to match string A from the file Note: the string A is not always same. it may change.. So the pattern A will match string A from the file, here i want to exclude that matched string and print remaining. In Simple words: whatever that pattern is matching it should be ignored.

17th Jul 2018, 4:11 PM
harish akula
harish akula - avatar
3 Antworten
+ 4
/^A/ig
17th Jul 2018, 4:26 PM
Calviղ
Calviղ - avatar
0
thank you for responding.. but my question is bit different ex: A= \d*\w*\s\d* is the pattern to match below lines from the file. lines=123hareesh 456, 675hello 789,...so on..file also includes other data.. So whatever the pattern A is matching that should be avoided. here in this case it should avoid first two lines.
17th Jul 2018, 4:50 PM
harish akula
harish akula - avatar
0
For js, you can try str.split(regex).join("") Here's the code: https://code.sololearn.com/Wc27FWRa9YkH/?ref=app
17th Jul 2018, 4:57 PM
LAWArthur