0

I have these tests string :

abc optional def ghi

abc def ghi

that both match this regex

(.+) ((optional \s*)?def)\s+(.+)

https://regex101.com/r/0pZQEy/1

but I want to group optional with def whereas it groups optional with abc, I can't see how to fix this

user310291
  • 36,946
  • 82
  • 271
  • 487

0 Answers0