Apologies to the BBEdit list members, this conversation is getting a little noisy and only borderline relevant to BBEdit. For what it's worth, I regularly use BBEdit to build and test regular expressions, since it's much easier to try a Search/Replace and "undo" it in BBEdit, than it is to edit, save and rerun a Perl script as I'm testing it :)
On 18/05/2011, at 12:57 , Bo wrote: > "URL to HREF" > Find: \b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:] > \s]|/))) > Replace: <a href="http://\1">\1</a> > Replace: <a href="http://\1" target="_blank">\1</a> (add > target="_blank") You'll be better off without the 'http://' bit there, since the regex will match URLs that already start with a scheme. Thus you'll end up with "http://http://www.VancourverIslandArtWorkshop.com" as a URL in one of the items down towards the bottom of the sample report that you showed us. This correction is potentially job-saving, so I'm posting to the list. To add the "http://" in there, I'd suggest a third regex, which you will need to run *last*: Find: href\s*=\s*"(?![[:alnum:]/]*?:) Replace: href="http:// Tick the box for "Grep" and "Wrap around". This will add the "http://" bit to only those HREF URIs which do not have something that looks like a scheme specifier in front: - href="mailto:[email protected]" will not be touched - href="http://foo.example.com" will not be touched - href="foo.example.com" will become href="http://foo.example.com" - foo.example.com by itself will not be touched Alex PS: I made a boo-boo. The correct scheme for emails is "mailto" not "email". That's the second "Email to HREF" regex I posted earlier. -- 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. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
