Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 正则表达式到字符串开头的马赫特定值_Regex_String_Match - Fatal编程技术网

Regex 正则表达式到字符串开头的马赫特定值

Regex 正则表达式到字符串开头的马赫特定值,regex,string,match,Regex,String,Match,嗨,我需要一个正则表达式来确定字符串是否以“(#)开头,其中#可以是1到99999之间的任何数字,以及“(#)之后的任何数字,包括符号 字符串 "(1) S0m3 - Str!n9" - Must found positive "(67) my $tr!n9 goes H3R3" - Must found positive "@n0Th3R (7) $tr!nG" - Must found negative "L0Ok @t the 3nD (57)" - Must found negative

嗨,我需要一个正则表达式来确定字符串是否以“(#)开头,其中#可以是1到99999之间的任何数字,以及“(#)之后的任何数字,包括符号

字符串

"(1) S0m3 - Str!n9" - Must found positive
"(67) my $tr!n9 goes H3R3" - Must found positive
"@n0Th3R (7) $tr!nG" - Must found negative
"L0Ok @t the 3nD (57)" - Must found negative
我在谷歌上搜索过,但我找不到任何结果,或者我不知道搜索什么,所以请引导我找到这个问题的答案


感谢您的时间:D

您正在查找指定字符串开头的
^
运算符。模式
/^\(\d+\)/
将匹配字符串开头任意数量的数字(用括号括起来)。

尝试以下操作:

/^\(\d{1,5}\)/

感谢你的帮助我可以用
^(\()([0-9]{1,4})(\)
谢谢你的帮助我已经想出了
^(\()([0-9]{1,4})(\)
但是你的方法也很有效,谢谢你的帮助:D