在xslt中使用regex匹配字符串的模式

时间:2022-02-15 23:35:09

I have a string in xml file "This is a subpara (10.1), subpara (1)"

我在xml文件中有一个字符串"这是subpara (10.1), subpara (1)"

I want to know the regex expression which find the word "subpara" followed by a "space" followed by a "(" and one or more "digits" and optionally followed by a "." and one or more digits followed by ")".

我想知道regex表达式,它找到单词“subpara”后面跟着一个“空格”,后面跟着一个“(”和一个或多个“数字”,可选地后跟一个“.”,一个或多个数字后面跟着一个“.”)。

I tried using the following but not getting the desire result:

我试着使用下面的方法,但是没有得到想要的结果:

<xsl:analyze-string select="." regex="subpara [\(\d+(\.\d+)?\)]+">

2 个解决方案

#1


2  

Here you go:

给你:

regex="(subpara \(\d+(\.\d+)?\))"

#2


1  

I managed to get it working using

我设法使它发挥作用

<xsl:analyze-string select="." regex="subpara\s\(\d+(\.\d+)?\)">

#1


2  

Here you go:

给你:

regex="(subpara \(\d+(\.\d+)?\))"

#2


1  

I managed to get it working using

我设法使它发挥作用

<xsl:analyze-string select="." regex="subpara\s\(\d+(\.\d+)?\)">

相关文章