嗨我是新的正则表达式。只想知道如何删除文档中特定标记中的“ - ”。我只想删除<TN>
标签中的' - '。谢谢!
<BusinessLine> <TN>905-694-9734</TN> <Type>buslinetype-HG</Type> <Status>InService</Status> </BusinessLine>
你可以使用这个正则表达式:
(?<=<TN>.*?)\-(?=.*?</TN>)
对于Java:
your_string= your_string.replaceAll("(?sim)(?<=<TN>.*?)\\-(?=.*?</TN>)", "");