Jump to content

regex 'lazy' eye-opener needed


Guy_
 Share

Recommended Posts

I could use a lesson in laziness... ;)

I sometimes come across this problem where I think I need to use regex 'lazy' and the stuff I'm trying doesn't work, cos I need an eye-opener example for one of my typical problems...

As an example a string of text where I *only* want the red spaces selected (or have a usable $1 and $2) after each piece of "quoted text" longer than 6 characters:

"12345!" Txt "12345!" Txt "123456789!" Txt "12345!" Txt "12345!" Txt "12345678!" Txt

The problem with what I'm trying is that it seems greedy and the selection doesn't stop at the first quote character (going backwards)...
I try '(?U)' and other stuff, but not seeing the light yet...

This is *not* what I want. I want the "12345!" instances ignored... (BTW: don't use '\d', cos it could be anything inside the quotes)
6HUKmRs.png

TIA :)

Edited by Guy_
Link to comment
Share on other sites

Can you try this ?

Yes, I got that to work for my purposes :) It may have a tiny mistake (or not) with the quotes, that I seem to have corrected.
I also got the impression that there are two types of typographers quotes that look exactly alike in some fonts and therefore I had to experiment a bit...

So it seems it had nothing to do with 'laziness' and you used another technique (with help of the exclusions, is my guess.)
I needed to understand that better too, so that will help me many times.

BTW: My intention was to double up the spaces behind the longer quotes, so I can now replace with "$1 "

Thanks!!

Edited by Guy_
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...