I wish I could replace all the text within the given symbols

64 views
Skip to first unread message

Putrefax

unread,
May 20, 2025, 3:37:48 PMMay 20
to BBEdit Talk
Hello everyone,

As on subject, I need to replace all the chacacters included in a continously changing interval.

EG:  <a href=\"https:\/\/abcdefghijt\/\" target=\"_blank\" rel=\"noreferrer noopener\"New Line Before Paragraph"La Fortezza di Bellinzona<\/a>

I'd like to ask BBEDIT to change everything from  <a href to /a>, including <a href and /a> themselves in the text that has to be changed.

Ty for you wise help.

Kaveh Bazargan

unread,
May 20, 2025, 4:33:45 PMMay 20
to bbe...@googlegroups.com
Hi Antonio

Try searching for 

(<a href=.+?<\\/a>)

and replacing by whatever you want. 

Regards
Kaveh

--
This is the BBEdit Talk public discussion group. If you have a feature request or believe that the application isn't working correctly, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: <https://mastodon.social/@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 bbedit+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bbedit/a56c461d-ce6a-4886-99cd-1079eaa0454bn%40googlegroups.com.


--
Kaveh Bazargan PhD
Director
River Valley ● X ● LinkedIn ● ORCID BlueSky
Accelerating the Communication of Research
https://rivervalley.io/news/river-valleys-review-awarded-ismte-innovation-award  https://bit.ly/446djXt  https://bit.ly/446djXt

Putrefax

unread,
May 21, 2025, 9:48:58 AMMay 21
to BBEdit Talk
It worked smooth as hell.
TYVM!

But which is the syntax to use this kind of find and replace on any combination of characters?
Unfortunately I have some other strings to replace from one to another one but your syntax doesn't work on those. :(

TY.

Kaveh Bazargan

unread,
May 21, 2025, 11:09:19 AMMay 21
to bbe...@googlegroups.com
let me know the syntax and I will try patterns for you.

This might help

Rick Gordon

unread,
May 22, 2025, 2:21:38 AMMay 22
to bbe...@googlegroups.com

In BBedit, Kevin’s sample <https://regex101.com/r/Y37GBu/1> works with only 2 backslashes (Python style, as originally presented), though it also works with the 3 backslashes, as you have it. (I was surprised to see the third backslash, but it does seem to be required for PGP style.)

It seems like one of those should work with pretty much everything, unless there is a line break in the search string, in which case, having (?s) at the start of the search string should do it.

Rick Gordon


From: Kaveh Bazargan <ka...@rivervalley.io>
To: bbe...@googlegroups.com
Date: Wed, May 21, 2025 8:08:52AM -0700
Subject: I wish I could replace all the text within the given symbols
let me know the syntax and I will try patterns for you.

This might help

On Wed, 21 May 2025 at 14:48, Putrefax <antonio....@gmail.com> wrote:
It worked smooth as hell.
TYVM!

But which is the syntax to use this kind of find and replace on any combination of characters?
Unfortunately I have some other strings to replace from one to another one but your syntax doesn't work on those. :(

TY.

Il giorno martedì 20 maggio 2025 alle 22:33:45 UTC+2 Kaveh Bazargan ha scritto:
Hi Antonio

Try searching for 

(<a href=.+?<\\/a>)

and replacing by whatever you want. 

Regards
Kaveh

On Tue, 20 May 2025 at 20:37, Putrefax <antonio....@gmail.com> wrote:
Hello everyone,

As on subject, I need to replace all the chacacters included in a continously changing interval.

EG:  <a href=\"https:\/\/abcdefghijt\/\" target=\"_blank\" rel=\"noreferrer noopener\"New Line Before Paragraph"La Fortezza di Bellinzona<\/a>

I'd like to ask BBEDIT to change everything from  <a href to /a>, including <a href and /a> themselves in the text that has to be changed.

Ty for you wise help.

_______________________________________
RICK GORDON
_______________________________________

EMAIL: ri...@rickgordon.com

Putrefax

unread,
May 22, 2025, 9:11:03 AMMay 22
to BBEdit Talk
TY everyone.,

Nothing better than a first suggestion and then trying and trying until one understands things.
This is what happened. Now I've learnt the logic that rules the syntax to use. :)

Reply all
Reply to author
Forward
0 new messages