I'm not sure if what I'm looking for is possible. I know I can do this with 
multiple links in a Text Filter but I've always been curious if I was 
missing an elegant way to do this in a single regex. I read about the 
If-Then Conditional Subpatterns in the user manual but that doesn't quite 
seem to support what I'm looking for.

In the example, I wish to update a tag with the 'bar' attribute giving it a 
specific value whether the attribute exists or not. I can do this but not 
without sometimes ending up with duplicating thet attribute or issues like 
that.
since I don't know what if any other attributes may be on each side of the 
'bar="..."' attribute my efforts have started off as something like the 
following:
http([^"]+)"([^>]*)(bar="that"|)([^>]*)>

However because of the need to use ([^>]*) to try and capture possible 
other unknow attributes, the following (bar="that"|) doesn't make sense 
because the previous group could include bar="that" and match the second 
half of (bar="Product"|)

examples of the result I'm wondering if I can achieve with a single regex.
a
find
<a href="example1" foo="this" bar="that" alt="maybe">
replace
<a href="example1" foo="this" bar="example1" alt="maybe">

b
find
<a href="example1" foo="this" alt="maybe">
replace
<a href="example2" foo="this" bar="example2" alt="maybe">

Is it possible and if so, how?

Thank you

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.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 post to this group, send email to [email protected].

Reply via email to