开发者

matching regex of a particular form

I want to match a regex of the following form

(hex_number) (anything) constant=(true or开发者_如何学C false)

anything can match any printable character or a space or tab. I am programming in java so I was using the following regex:

(\\p{Alnum}+) (\\.+) constant=(true|false)

The first two matching groups is what I really want. I however do not get a match.

Any ideas?

PS: Alnum and . are just for simplicity and it is fine that they will match more than what I require.


Edit: Can't believe I missed this the first time. You want ., not \\.. Your version matches a literal . character.

([0-9A-Fa-f]+)\\s(.+)\\sconstant=(true|false)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜