Hello, I am often using http://www.regexpal.com to test out reg-ex patterns. This also contains a handy list of codes, and gives you the opportunity to test the reg-ex before using it in BBEdit Search/Replace or Multi File Search/Replace.
<https://lh3.googleusercontent.com/-t9Xyi0b55MU/WLnaI550NtI/AAAAAAAAFeg/dZJONs4OFmMuLDlv2cL4RTHmhJuAhVPTgCLcB/s1600/Skjermbilde%2B2017-03-03%2Bkl.%2B21.59.09.png> Hovering over the parts of the reg-ex explains each individual part with a tooltip. Having at least two instance to replace, and at least one not to replace tells if both gives a hit (As marked in the screenshot) I used this for test: <a href="([a-zA-Z0-9-/_]*.html) <https://lh3.googleusercontent.com/-NmfUa3kcp1k/WLnahgEAbTI/AAAAAAAAFek/qSTE3utuFDwY1uQ5eh3YLnFCge6WIZ2hACLcB/s1600/Skjermbilde%2B2017-03-03%2Bkl.%2B21.58.58.png> Hope this helps. – Ole Kristian Ek Hornnes Systemkonsulent søndag 26. februar 2017 10.55.45 UTC+1 skrev Bill Kochman følgende: > > Hello again, > > I want to convert all of my relative URLs to absolute URLs. > > The problem is that I do not know where the remaining relative URLs are > located in my virtual host's folder. > > I have been reading the grep patterns section of the BBEdit manual, but I > still haven't quite understood how to apply what I have been reading. > > For example, many of my current absolute URLs look like the following, > where "my-article" represents the actual name of the file: > > <a href="https://www.billkochman.com/Articles/my-article.html > > However, there are some places -- as I said, unknown to me -- where there > are relative URLs which look like the following: > > <a href="my-article.html > > I want to change all of those relative URLs so that they are preceded by " > https://www.billkochman.com/Articles/". > > In looking at the BBEdit grep section, I get the impression that maybe I > need to use an "if-then" or "if-then-else" conditional subpattern. However, > if that is the case, as I said, I don't quite understand how to implement > it. > > If I use this: > > \t\t<a href="(.+)\.html > > It obviously finds all of the current absolute URLs. BTW, those "\t" are > there because all such lines are prefixed by two tabs. > > So what pattern do I use to convert the remaining relative URLs to > absolute URLs, without affecting the current absolute URLs? > > In other words, <a href="my-article.html should turn into <a href=" > https://www.billkochman.com/Articles/my-article.html. > > Thanks in advance. Some of this stuff is just a little over my head. > > Kind regards, > > Bill K. > > -- 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.
