That turns your original example
(http://www.mysite.com/section/subsection/Z3245678a34/)
into:
<a href=""
href=""
>">Z3245678a34</a">a</a>>
& is a capture for the whole original _expression_ -- not what
you want.
I also see that my own suggestion was flawed. The [[:punct:]]
part is not working right (on mine or yours) and needs
reconsideration, but I'm in the middle of other stuff right now.
Also, the \r should be \n for BBEdit, but actually is not
necessary at all, because the $ part takes care of it anyway.
------------------
On 3/5/13 at 3:16 PM -0600, Christopher Stone wrote in a message
entitled
"Re: Learning GREP - need help with one example":
On Mar 05, 2013, at 12:17, Rick Gordon <[email protected]> wrote:
> Actually, it would be better to set the last slash to be optional (as below), in case the URL doesn't end in a slash. It would would require a bit more of a tweak to handle query URLs with ?, &., and =., but totally doable:
>
> (https*://\S+/)(\S+?)(/?)(?:(?=[> \t\r])|(?=[[:punct:]])|(?=$))
> <a href=""> ______________________________________________________________________
Hey Rick,
That's a pretty good pattern. I've simplified it a bit though - would you scope it out and see if you can find hiccoughs?
https?://\S+/(\S+?)/?(?:(?=[[:punct:] >\t\r]|$))
<a href="">
Thanks.
--
Best Regards,
Chris
--
___________________________________________________
RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________
WWW: http://www.shelterpub.com
RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________
WWW: http://www.shelterpub.com
--
--
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>
---
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].
For more options, visit https://groups.google.com/groups/opt_out.
