I have a similar situation and am wondering if this would work...

The Find pattern you described will indeed find all of the URLs in my 
document, but if I want to replace each of them with the same root URL, 
(So, instead of href="\0", I could use href="example.com") is this 
something I could modify the script to do?

On Thursday, February 4, 2021 at 2:44:02 PM UTC-5 [email protected] wrote:

> You can use Find/Replace to do this. Open the Find dialog from the Search 
> menu, check the "grep" box at the bottom which allows you to use regular 
> expressions, and use these patterns to start. The first find https:// 
> followed by the characters that are commonly found in URLs. The second 
> replaces that with an anchor tag with the found text \0 used twice.
>
> Find: https?://[a-zA-Z0-9/:\?&%=._\-+]+
> Replace: <a href="\0" target="_blank">\0</a>
>
> Find the first entry and if it needs replacing choose Replace and Find 
> Next or simply Find Next if it doesn't need replacing. Or, if you don't 
> have any links that are already formatted in the document you can do 
> Replace All. I have key shortcuts assigned to these so I can quickly work 
> through a document.
>
> The Pattern Playground on the Search menu is useful for playing around 
> with the find/replace patterns as well.
>
> Hope this helps,
>
> [fletcher]
>
> On Feb 4, 2021, at 11:24 AM, Martin <[email protected]> wrote:
>
> Hi,
> this is my first post to this group. I hope I can express myself clearly 
> ...
>
> Can I use BBEdit to automatically convert lots of web addresses (e.g. 
> https://test.com) in an html document into hyperlinks? Perhaps by 
> assigning a <a> tag with "Search and replace" so that something like this 
> arises: <a href="https://test.com"; target="_blank"> https://test.com </ a 
> >?
>
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/5d8eea22-1b3c-49ca-8ced-202402d196ean%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bbedit/5d8eea22-1b3c-49ca-8ced-202402d196ean%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/f5686aad-0a96-4eb4-a5a8-3d70fe63d9c1n%40googlegroups.com.

Reply via email to