Looking at the original problem here, I note that your original
constraints may be exactly what you need (border=0, and ignore any
other case). But most people would want a script that strips out the
src of all img tags, regardless if it had border defined or not, or if
border happened to be nonzero, or if quotes were properly used around
the border value, etc.

So here's how I approached it
1. replace < with \r<
2. replace > with >\r
3. replace ^(?!<img)(.*)\r with nothing
4. replace (.*)src="(.*?)"(.*)\r with \2\r

That reads like this:
Lines 1 and 2 = put HTML tags on their own line
Line 3  = nuke any line that doesn't start with <img
and finally, look for the src - i broke it into 3 groups (i could have
done 1 group, I realize now) and replace with group 2 (which is the
contents of the quotes after src)

>From this, I leave it as an exercise to you if you do need to put your
original constraints back in (matching border=0 exactly).

tell application "BBEdit"
        replace "<" using "\\r<" searching in text 1 of window 1 options
{search mode:grep, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
        replace ">" using ">\\r" searching in text 1 of window 1 options
{search mode:grep, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
        replace "^(?!<img)(.*)\\r" using "" searching in text 1 of window 1
options {search mode:grep, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
        replace "(.*)src=\"(.*?)\"(.*)\\r" using "\\2\\r" searching in text 1
of window 1 options {search mode:grep, starting at top:true, wrap
around:false, backwards:false, case sensitive:false, match
words:false, extend selection:false}
end tell


-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.

Reply via email to