正则表达式格式网址 [英] regular expression format url
本文介绍了正则表达式格式网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
需要帮助来编写正则表达式以获取更改URL
need help to write regular expression to take change urls
来自: http://vermon.com/good/helping.html 注意:商品有时可能会有所不同
from: http://vermon.com/good/helping.html NOTE: good may change at times to something different
至: http://suresite.com/helping.html
请注意:我正在更改基本URL并删除好字
PLEASE NOTE: I am changing the base url and taking out the word good
推荐答案
您可以尝试使用Java:
You could try with Java:
System.out.println(
"http://vermon.com/good/helping.html"
.replaceAll("(http://)[^/]+/good(/.+)", "$1suresite.com$2"));
输出:
http://suresite.com/helping.html
这篇关于正则表达式格式网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文