Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下 XML 行:
<indexentry><secondaryie>definition, 3/2/4</secondaryie></indexentry>
我需要一个与上述匹配的正则表达式并将其转换如下:
ABC3(the first number)/P-2(second number)-4(third number)
我怎样才能做到这一点?
使用这个正则表达式:
([0-9]+)/([0-9]+)/([0-9]+)
并从捕获的组 #1、#2、#3 中创建您的字符串:
ABC3\1/P-2\2-4\3