Normally relative links are a better way to run a site — you can move pages to 
a different host, put them in sub-directories, etc., without changing the HTML.

<a href="([^/]*)$

() The brackets are used to ‘capture' the find, so you can use the result in 
the replace

[] Square brackets mean ‘character class’, which searches for the given 
characters

^ because the character class starts with a caret, everything inside the square 
brackets is negated

/ so we’re looking for anything which isn’t a slash

* look for 0 or more occurrences of anything which isn’t a slash

$ keep going until the end of the line.

Hope this helps.


> On 2017-02-27, at 05:54, Bill Kochman <[email protected]> wrote:
> 
> Hello Jean-Christophe,
> 
> Thank you for your assistance. I appreciate it.
> 
> Using that grep pattern found only ONE relative URL in almost 6,000 HTML docs.
> 
> Considering how much I have used BBEdit’s multi-file find and replace feature 
> to make global changes to my primary virtual host over the past few weeks in 
> order to bring it up to specs for AMP, I do find that rather suspect.
> 
> In other words, I would think that there would still be at least a few more 
> hidden relative URLs floating around on the site, and not just one.
> 
> On the other hand, if there really was only one, then I must have done a 
> better job than I thought. :)
> 
> While I can just copy and paste that grep pattern and use it — which I did in 
> fact do — I really learn nothing from the experience.
> 
> Having said that, can you please take a few more minutes of your time to 
> explain to me what each part of that grep pattern does?
> 
> I understand some of it, but not all of it put together.
> 
> For example, I know that ^ means the beginning of a line, that $ means the 
> end of a line, and * is like a wild card, right?
> 
> But put all together with the two brackets and the forward slash, my 
> understanding gets lost.
> 
> Thank you, my friend.
> 
> Kind regards,
> 
> Bill Kochman
> 
> 
>> On Feb 26, 2017, at 8:41 PM, Jean-Christophe Helary 
>> <[email protected]> wrote:
>> 
>> Bill,
> 
>> There is not need to check for the presence of tabs since what you want 
>> concerns only the URL.
>> 
>> Since the relative URLs don't (seem to) include a /, I'd use that pattern to 
>> look for them:
>> 
>> <a href="([^/]*)$
>> 
>> And I'd replace with:
>> 
>> <a href="https://www.billkochman.com/Articles/\1
>> 
>> Jean-Christophe 

-- 
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].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to