[英]Match resulting String using regex
I have a string 00408-B193AQ-P-DW-11045
which is a TAG of Pipe. 我有一个字符串
00408-B193AQ-P-DW-11045
,它是Pipe的TAG。 Using regex I want to match only B193AQ-DW-11045
.Using global option I am able to get the required using regex [AZ][0-9a-zA-Z][^P]+
. 使用正则表达式,我只想匹配
B193AQ-DW-11045
。使用全局选项,我可以使用正则表达式[AZ][0-9a-zA-Z][^P]+
。 But ours system supports ignore case (not global). 但是我们的系统支持忽略大小写(不是全局)。 So with ignore case need a regex which gives the required result.
因此,在忽略大小写的情况下,需要一个给出所需结果的正则表达式。
If You check programmatically You could broke into named groups: 如果您以编程方式进行检查,则可以分为命名组:
(?'index'[\d]{5})-(?'index1'[0-9a-zA-Z]{6})-(?'index3'[A-Z])-(?'index4'[A-Z]{2})-(?'index5'[0-9]{5})
Returns: 返回值:
index: 00408
index1: B193AQ
index3: P
index4: DW
index5: 11045
If just check for matching some of parts try use this pattern: 如果仅检查某些部分是否匹配,请尝试使用以下模式:
.{5}-([0-9a-zA-Z]{6})-.-([A-Z]{2})-([0-9]{5})
Here '.' 这里 '。' (dot) means any character
(点)表示任何字符
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.