Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我[0x]?\d+用来尝试定位自然字符串
[0x]?\d+
0x10101 0x12341 12321
但是当我在 上运行正则表达式时0x3,我得到[u'0', u'x3'].
0x3
[u'0', u'x3']
似乎(在我未经训练的眼中)它匹配最短的序列?或者我的使用有什么问题[]?吗?
[]?
[...],称为字符类,匹配单个字符。
[...]
你可能想要:
(?:0x)?\d+