如果我有一个字符串:
This is a sentence. It also has a url www.example.com.
我怎么能打破它,把它变成
This is a sentence. It also has a url www example com.
注意网址已损坏,但其他点未被删除。 我怎么用java做这个?
答案 0 :(得分:0)
您可以使用像这样的正则表达式
/^www\.([a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9])\.([a-zA-Z]{2,})$/