2

我有以下 XML 行:

<indexentry><secondaryie>definition, 3/2/4</secondaryie></indexentry>

我需要一个与上述匹配的正则表达式并将其转换如下:

ABC3(the first number)/P-2(second number)-4(third number)

我怎样才能做到这一点?

4

1 回答 1

1

使用这个正则表达式:

([0-9]+)/([0-9]+)/([0-9]+)

并从捕获的组 #1、#2、#3 中创建您的字符串:

ABC3\1/P-2\2-4\3
于 2013-10-22T12:50:46.647 回答