[英]Regex to detect numbers only between special characters
I need Regex to detect numbers only between special characters. 我需要Regex仅在特殊字符之间检测数字。
Pattern ;\\d+=\\d+?
模式
;\\d+=\\d+?
String 0014;5010730101000033347=4510120173?AA
字符串
0014;5010730101000033347=4510120173?AA
My objective is to get this string 我的目标是得到这个字符串
;5010730101000033347=4510120173?
The \\d+?
\\d+?
at the end of the pattern matches 1 digit, no more, due to the +?
由于
+?
,模式末尾匹配1位,不再匹配+?
lazy quantifier matching 1 or more occurrences, but as few as necessary to return a valid match . 匹配1个或多个匹配项的延迟量词 ,但返回有效匹配项所需的数量最少 。
You may use 您可以使用
;\d+=\d+\?
^^
C# declaration: C#声明:
string pattern = @";\d+=\d+\?";
See the regex demo 见正则表达式演示
Details : 详细资料 :
;
- a semi-colon \\d+
- 1 or more digits \\d+
-1个或更多数字 =
- an equal sign =
-等号 \\d+
- 1 or more digits \\d+
-1个或更多数字 \\?
- a literal ?
?
char
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.