: GREP rule to catch all types of web link / URL I'm looking to build a robust, reliable GREP rule to catch all web links and URLs that appears in text, covering all possible characters and
I'm looking to build a robust, reliable GREP rule to catch all web links and URLs that appears in text, covering all possible characters and gotchas like HTTPS, or URLs in brackets like (http://whatever.com), or followed by punctuation like whatever.com?! It's for an InDesign paragraph style GREP rule.
I've put the best I've come up with so far down below as an answer - is it missing anything, is there anything more robust or straightforward?
More posts by @Kaufman565
1 Comments
Sorted by latest first Latest Oldest Best
This seems to work pretty well:
https?://.*?(?=()|.|,|?|!|"|')*($|s))
Start with either or
https?://
...then match the shortest uninterrupted string of any characters
-.*?
...that is followed by, but doesn't include
the (?= ) "positive lookahead"
...zero or more of any common punctuation - ) . , ? ! and any type of single or double quotation mark, curly or straight, left or right
()|.|,|?|!|"|')*
...and then either the end of the paragraph or any type of whitespace
($|s)
Some testing:
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.