【问题标题】:Regex matching punctuation and roman in lowercase [duplicate]正则表达式匹配标点符号和小写罗马字母[重复]
【发布时间】:2011-03-01 19:49:08
【问题描述】:

可能重复:
How do you match only valid roman numerals with a regular expression?

嗨,

我如何将正则表达式匹配到类似的东西

[i])
[ii])
[iii])
[iv])

等等……

谢谢

【问题讨论】:

  • 是的,方括号是我要匹配的一部分

标签: java regex roman-numerals


【解决方案1】:
/^\[[ivmcldx]+\])/

应该抓住最常见的罗马数字。不过,它不会偶然发现像 iiix 这样的无效数字。

【讨论】:

  • ) 需要转义。
猜你喜欢
  • 2013-06-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-05
  • 1970-01-01
  • 2019-09-27
  • 2014-10-12
相关资源
最近更新 更多