On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote:
> On 18/05/18 13:30, The Sidhekin wrote:
> >
> >   /<!before .* gm> ^ <[d..z]>* $/
> 
> That's pretty good! Putting the beginning-of-string anchor ^ anywhere
> but the very start is surely an advanced move :)

FWIW, sometimes I think it's worth inverting the entire regex -- i.e., instead 
of matching finding things that do match, exclude the things that don't:

   / gm | <-[d..z]> /

This regex will match any string containing the sequence "gm" or any character 
that isn't in the range "d".."z", which is the inverse of what was required 
(strings containing only "d".."z" and never "gm").  Then use !~~ or some 
similar logic to get the strings wanted.

I recognize that this approach might not fit well in all cases, but it's 
another (perhaps cleaner) approach to getting what's wanted.

Pm

Reply via email to