0

我需要在 $ 之后拉出这串字符

($Q1==1)and($Q4o=="55")and($Q1o1=="")

$Q1的意思$Q4o是这些$Q1o1

据我了解,正则表达式应该从$A-Za-z0-9_. 你能帮我写正则表达式吗?

4

2 回答 2

4

This seems to work, at least in Ruby:

/\$\w*/

Be careful with the $, as $ is a reserved symbol in regular expressions that means "end of the string", so you need to escape it.

于 2012-11-15T15:36:19.493 回答
0

/\$([[:alnum:]]+)[[^:alnum:]]/

您需要提取第一个括号表达式。

编辑:我更喜欢另一个建议,使用 \w*

于 2012-11-15T15:37:14.453 回答