简体   繁体   English

正好匹配一个 $(美元)后跟任意数量的数字的正则表达式应该是什么?

[英]What should be the regular expression which matches exactly one $ (dollar) followed by any number of digits?

$ : match results $
$637 : match results $637
$$ : match results $
$272$ : match results $272
$262$$ : match results $272
$$445: match results $
3727 : match results null
2727$: match results null

$ is a special character that represents the end of the string. $是一个特殊字符,表示字符串的结尾。

Escaping the dollar symbol should solve your problem:转义美元符号应该可以解决您的问题:

^\$\d*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM