你好,这是我的字符串不要在正则表达式获取字符串中的描述内容
/* anything description */ Data1 = value1; Other_Data = Other_Value; /* my other description */ Anything = Any_Answer; /* this is description and must not detect Description_Data = Any_Value; */
现在我想用正则表达式,并得到这样的
Data1 Other_Data Anything
和
value1 Other_Value Any_Answer
在数组中,但我不想要正则表达式检测任何内部(描述框)
/* */像
Description_Data = Any_Value;
这是我的正则表达式
\h*(.*?)\h*[=]\h*(.*?)\h*[;]
我的问题是,正则表达式得到即使在说明书和一些按键所有的按键和值,键之前像所有的描述键之前得到的一切......我想就这样
Data1 Other_Data Anything
和
value1 Other_Value Any_Answer
有什么问题?
键和值只包含字母数字和下划线吗? –
请分享你的尝试。 –
用我的正则表达式更新 – MyJustWorking