0

I am trying to find a regular expression which does not match the below string:

xxx_yyyyyy_zzz_aaaaa
xxx_yyyyyy_zzz_aaaaa_cat
xxx_yyyyyy_zzz_aaaaa_uom

My regular expression should get me only xxx_yyyyyy_zzz_aaaaa and not the ones which contain _cat and/or _uom. Basically I am trying to filter out rows with _cat and _uom from my rows using regex.

jkdev
  • 11,360
  • 15
  • 54
  • 77
vignesh asokan
  • 137
  • 3
  • 12

1 Answers1

1

Try Regex: (?:[a-z]+(?:_[a-z]+)*)(?<!_cat|_uom)\b

Demo

Matt.G
  • 3,586
  • 2
  • 10
  • 23