Copy link to clipboard
Copied
I'm trying to write a GREP that will check for commas and full stops that don't have whitepspace after them.
It would look for the two issues in this paragraph.Missing spaces after the fullstop,and also the comma.
The problem is that it also finds all the URLS such as:
www dot bob dot com (<--- had to write it like this or the forum didn't like it!).
I've used many variations around this sort of idea:
([\.,])[^ ].*(?!\.com)
... but it's just greedy and grabs the whole URL rather than ignoring it.
I should add that my documents contain an annoying number of URL suffixes, such as .co.uk, .com, .au!
At your own risks! … [just tested on a simplistic sample] =D
(?!(\h|\H*\.(com|(co\.)?uk|au)\>|$))[.,](?=\S)
[code corrected]
(^/) The Jedi
Copy link to clipboard
Copied
I don't believe this is possible as a single-step process. I would approach by first finding urls and adding some sort of tag to them that won't otherwise appear in your text swo as to protect them from being found in the next step, then search for your un-spaced punctuation and fix it, then find and remove the tags you added in the first step.
Copy link to clipboard
Copied
Hey Peter, thanks for answering. That'll be why I've been struggling with it then! Is the searching for results NOT tagged with something reliant on the use of conditions?
Copy link to clipboard
Copied
At your own risks! … [just tested on a simplistic sample] =D
(?!(\h|\H*\.(com|(co\.)?uk|au)\>|$))[.,](?=\S)
[code corrected]
(^/) The Jedi
Copy link to clipboard
Copied
Wow this is massively improved over what I'm using at the moment. Thanks! I'm going to studay this really carefully and get my head around it. Thanks FRIdNGE!