字符串转换和连接

时间:2013-10-22 12:49:16

标签: regex xslt

我有以下XML行:

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

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

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

我该怎么做?

1 个答案:

答案 0 :(得分:1)

使用此正则表达式:

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

从被捕获的组#1,#2,#3创建你的字符串:

ABC3\1/P-2\2-4\3