开发者

match exactly a word starting with $( or special character)contained in a string in Perl

how do i exactly match a word like $abc from a string "this i开发者_运维问答s $$abc abc$abc $abc abc_$abc_ing";


You can use the regex:

(\$[a-z]+)

Explanation:

(        : Start of group
  \$     : A literal $. Since $ is a metacharacter we escape it.
  [a-z]+ : one or more letters that is a word. You can use the modifier i 
           to match uppercase letters aswell.
)        : End of grouping
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜