问题
need help to write regular expression to take change urls
from: http://vermon.com/good/helping.html NOTE: good may change at times to something different
to: http://suresite.com/helping.html
PLEASE NOTE: I am changing the base url and taking out the word good
回答1:
You could try with Java:
System.out.println(
"http://vermon.com/good/helping.html"
.replaceAll("(http://)[^/]+/good(/.+)", "$1suresite.com$2"));
Output:
http://suresite.com/helping.html
来源:https://stackoverflow.com/questions/46369870/regular-expression-format-url