0

Let's say I have the following 7 strings

Seven Swans a Swimming
Six Geese a Laying
Five Golden Rings
Four Calling Birds
Three French Hens
Two Turtle Doves
and a Partridge in a Pear Tree

I want to write a regex to capture only the last 5 strings by using negation, negating "Geese" and "Swans". Is there a straightforward way to do it? My best solution is https://regex101.com/r/QprpQZ/1.

The equivalent solution I would like to get is:

.*(Golden|Birds|Hens|Doves|Partridge in a Pear Tree).*
bryan.blackbee
  • 1,934
  • 4
  • 32
  • 46

0 Answers0