Wednesday, 15 April 2015

dreamweaver - RegEx to find all possible relative links to a specific file - also capture link text -



dreamweaver - RegEx to find all possible relative links to a specific file - also capture link text -

yes, there's hundreds of [regex] [html] topics on so, first 30 i've checked don't help me problem.

i've got 745 total links (all relative, , have remain relative) file in site. need find these links , append info before , after them. need capture , utilize link text.

i've tried several expressions , regex below closest can get, it's not plenty - keeps finding few instances of other href different file , captures content way </a> of file care about.

<a href="((.)*?)?myfile.html((.)*?)?>((.)*?)?</a>

in above, need capture relative path file , anchors might present, actual link text.

what regex should using?

it shouldn't matter, i'm using adobe dreamweaver perform search.

the next regex should work need:

<a href="([^"]*?a\.fparameters\.html)(#[^"]+?)?".*?>(.*?)<

it work if have urls like:

<a href="a.fparameters.html">jobmaxnodecount</a>

that not have #xxxx.

a few examples:

for <a href="a.fparameters.html#jobmaxnodecount">jobmaxnodecount</a>you get:

group 1: a.fparameters.html group 2: #jobmaxnodecount group 3: jobmaxnodecount

for <a href="commands/mjobctl.html#modify">mjobctl -m</a> modify job after has been submitted. see <a href="a.fparameters.html#rsvsearchalgo">rsvsearchalgo</a> one match:

group 1: a.fparameters.html group 2: #rsvsearchalgo group 3: rsvsearchalgo

regex dreamweaver

No comments:

Post a Comment