Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How can I write regex to redirect these links?

Hi !

I am a novice who wants to re-direct certain links(which have similar names) to a single link using an addon that demands regex. I have been trying to learn regex quickly but so far have not succeeded. If you could please help me with this, I'd be grateful.

These are the sample links I want to redirect:

http://119.81.17.211/master/Check.aspx?enc=SHTQGW4...

http://119.81.17.211/master/Check.aspx?enc=SHTQGW4...

http://119.81.17.211/master/Check.aspx?enc=SHTQGW4...

I want to redirect these to the following link:

http://4gp.tw/b025/1386177834502.pdf

Thanks a lot.

1 Answer

Relevance
  • 7 years ago
    Favorite Answer

    http://d+/d+/d+/d+/master/Check/.aspx

    That regex should do it. It isn't elegant, but it should work. You might need to make the backslashes ( / ) literals with the forwardslash ( \ ), I can't remember if its a special character or not.

    \d - decimal number.

    + - one or more of the previous.

    \. - a literal period. Otherwise the period would be treated as the wildcard character and match anything.

    Source(s): Network Admin
Still have questions? Get your answers by asking now.