0

I need to ignore all between two marks, but what I get is all inside it.

With the regex '.*?' and input asd'asd'asd 'asd'asd I get only the matches 'asd' and 'asd'.

https://regex101.com/r/hHz48H/1

How can I match the opposite of it?

InSync
  • 4,851
  • 4
  • 8
  • 30
  • You could replace the matches with an empty string, this does not give you the separate parts though.. – The fourth bird Aug 07 '23 at 13:19
  • Please clarify what do you want to get as an output for your sample – Ulugbek Umirov Aug 07 '23 at 14:18
  • I have an odataexpression to split, I need to split all 'and' and 'or' operators of string. But, I cannot split text inside of quotation mark. Example: $filter=(Filter eq ' or ' or Filter eq ' and ') I want only split the single Or operator. – Guilherme Bley Aug 07 '23 at 14:27
  • Does this answer your question? [A regular expression that matches any single character not matched by another regular expression](https://stackoverflow.com/questions/76816665/a-regular-expression-that-matches-any-single-character-not-matched-by-another-re) – InSync Aug 07 '23 at 19:28
  • 1
    If you want to avoid filtering for some reason, I guess [`(?<=^(?:[^']*|'[^']*')+)[^']+`](https://regex101.com/r/GMKlGE/1) would work too. – InSync Aug 07 '23 at 19:35
  • @InSync That solves the problem. Here the regex: https://regex101.com/r/oJJrcZ/1 Thanks – Guilherme Bley Aug 08 '23 at 00:20
  • your regex is good if you change from match to split: `"foo'asd'bar 'asd'baz" -split "'.*?'"` – Santiago Squarzon Aug 08 '23 at 01:35

0 Answers0