在 Websphere MQ 中使用正则表达式



因为我是正则表达式的新手,任何人都可以给我以下正则表达式的详细说明:-

ZBC_EXTR[0-9]{0,1}_STOCK_([A-Z]{0,1}|[0-9]{0,1})

这是正则表达式正在寻找一个包含不同部分的字符串。

"ZBC_EXTR" - The string must begin with these characters
"[0-9]{0,1}" - Looks for a digit 0-9, can appear 0 times but not more than once
"" - Escape character(Escapes the following character for regex engine) 
"_STOCK_" - Must have these set of characters next
"(" - Beginning of the group expression
"[A-Z]{0,1}" - Look for alpha, capital character,can appear 0 times but not more than once
"|" - The logic OR expression
"[0-9]{0,1}" - Looks for a digit 0-9, can appear 0 times but not more than once
")" - End of the group expression

例如,以下字符串将与正则表达式匹配:

ZBC_EXTR8_STOCK_
ZBC_EXTR_STOCK_
ZBC_EXTR_STOCK_F

但是这些字符串不匹配:

ZBC_EXTR_STOCKF
ZBC_EXTRA_STOCK_F
ZBC_EXTR45_STOCK

正则表达式的一个很好的资源:https://www.regular-expressions.info/

相关内容

  • 没有找到相关文章

最新更新