I'm New to PHP and Regex, I'm trying to exclude a word from the search using Yith Bulk Editing Woocommerce and WordPress.
Now I paid for the plugin but the support is very slow and not helpful at all.
When I use the regular expression to look for products I have over 10,000 of them.
An example I have Fasteners Hex Nuts over 3500 of them I would like to exclude any hex nut that has nylon in it the title. so I used the following in the search Hex Nut.?+(?!Nylon).?+$
but that gives me no products found, I have come across a website https://regex101.com/ that helps you debug your regex but for someone that is now to it it does not work.
I have tried the following
Hex Nut.?+(?!Nylon) - No Results
Hex Nut.?+(?:Nylon) - No Results
Hex Nut.?+(?:Nylon) - No Results
Hex Nut^/(?!Nylon) - No Results
Platforms are the following
YITH WooCommerce Bulk Product Editing - Version 1.2.29
Woocommerce - Version 4.9.0
WordPress - Version 5.6
The Answer is
^Hex Nut(?!.*\bNylon\b).*$
see https://regex101.com/r/0H1Tig/1I needed to use a word boundary to make it work, as far as I can tell is the same as double quotations.