Javascript regex to exclude pattern only if other pattern doesn't match
A regex is required to exclude clauses with wag[.|on]
or ut[i|e]
, but only if NO is sed[.|an]
present and allows all other clauses. any suggestions?
i.e. exclude matches that are only wagons or only ute.
I've tried /[^wag[on|.]]/ig.test(sentence)
but this path won't allow exclusion. I only need to select the yes sentences as shown below.
Considering the following suggestions:
sedan fast - <- yes another sed. also fast - <- yes wagon slow <- no
other wag. also slow <- no
ute slower <- no
other uti also slow <- no
vag. and the carriage is slower then sed. or sedan - yes uti or ute is slower than sed. or a sedan - yes, both wag. wagon, uti and ute are slow. nothing fast or slow <- yes
source to share