Title: RE: Learning GREP - need help with one example
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="">


------------------

On 3/5/13 at 10:07 AM -0800, Rick Gordon wrote in a message entitled
"Re: Learning GREP - need help with one example":

(https*://\S+/)(\S+?)(/)(?:(?=[> \t\r])|(?=[[:punct:]])|(?=$))
<a href="">

Finds http or https

May be followed by space, tab, return, punctuation, or end of line (even at end of doc with no return)

------------------

On 3/4/13 at 8:54 PM -0800, Scott wrote in a message entitled
"Learning GREP - need help with one example":

Hi guys,

I am fascinated by the GREP capabilities of BBEdit and have been trying to immerse myself in it. I am a complete regex newbie, but I'm starting to understand some of the concepts. However t I need some more practical examples in order to figure it out.

Here's my latest problem.

Let's say I have a URL like this:

http://www.mysite.com/section/subsection/Z3245678a34/

And I want to turn it into an html link with the last element as the highlighted text:

<a href="" >">Z3245678a34</a>

What would I use as the search & replace values?

I hope to learn how to find substrings between certain characters (like "/"). The "Z3245678a34" could be anything. "Unicorn123", "mypage"," learningisfun4all".

Any help would be much appreciated. Also if anyone knows of some good sites with lots of GREP examples, I'd be grateful.

thanks

SB
--
--
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.
 
 


--
___________________________________________________

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.
 
 


-- 
___________________________________________________

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.
 
 

Reply via email to