Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


GREP assistance? Punctuation without following space that is WWW proof

Contributor ,
Aug 24, 2021 Aug 24, 2021

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!

TOPICS
Scripting

Views

67

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Aug 24, 2021 Aug 24, 2021
At your own risks! … [just tested on a simplistic sample] =D (?!(\h|\H*\.(com|(co\.)?uk|au)\>|$))[.,](?=\S) [code corrected] (^/)  The Jedi

Likes

Translate

Translate
Adobe Community Professional ,
Aug 24, 2021 Aug 24, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 24, 2021 Aug 24, 2021

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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Aug 24, 2021 Aug 24, 2021

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 24, 2021 Aug 24, 2021

Copy link to clipboard

Copied

LATEST

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!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines