> On May 14, 2023, at 11:29, 'Andy Nickless' via BBEdit Talk > <bbedit@googlegroups.com <mailto:bbedit@googlegroups.com>> wrote: > > Something that I've been unable to find out is how to skip searching > something which already contains a simple pattern: > For instance, to find a number consisting 1-3 digits I use (\d{1,3}) - but > how can I AVOID a number of up to 3 digits?
Hey Andy, It's really necessary to provide proper examples when asking for help with regular expressions... One needs to be able to visualize and test with real-world data to be able to untangle this sort of problem properly. I can't think of a way using only regex to avoid all of the possible pitfalls – this example using a negative-lookahead will match only the lines in the middle block. __PATTERN__ <strong>(?>(?:(?!</strong>|\d{1,3}).)*)</strong> ___TEST DATA___ <strong>1</strong> <strong>10</strong> <strong>100</strong> <strong>2000</strong> <strong>20000</strong> <strong>Thank you India</strong> <strong>Thank you terror</strong> <strong>Thank you disillusionment</strong> <strong>Thank you frailty 1</strong> <strong>Thank you consequence 22</strong> <strong>Thank you thank you silence 33</strong> The only way I can think of to manage this puzzle in a bombproof way is to script it, and I'd probably use Perl for that. -- Take Care, Chris -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "supp...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/B81B9D59-5DF4-4EB8-8DDF-1E02A2DEFB54%40gmail.com.