开发者

Regular Expression To Find Word Document Text of Similar Format, but Varying Length

开发者 https://www.devze.com 2023-03-22 06:27 出处:网络
Given a sample of some possible text containing the format $[I-VI].[1-99].[1-99].[1-99]… I am trying to build a regular expression that will find all text formatted this way.

Given a sample of some possible text containing the format

$[I-VI].[1-99].[1-99].[1-99]…

I am trying to build a regular expression that will find all text formatted this way.

So, some samples might be

  • $II.4.13
  • $V.23.38.1.23
  • $IV.1.1.1.1.1

As you can see, the length of the text is varying, but there are some known parameters. The most levels deep is 7, the $ always exists and there is always a . separating all roman numerals / numbers (except the last number).

Any suggestions? Admittedly, I am currently weak in determining regular expressions.

I am using Word 2010 to try to find this text in a document, so Microsoft Office RegEx syntax 开发者_开发技巧would be preferred; but C# would be fine too as I could write a program to search the text and find this text as well.


\$(I|II|III|IV|V|VI)(\.[0-9]{1,2})+

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号