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']
(私の訓練されていない目には)最短のシーケンスに一致しているように見えますか?それとも私の使用に何か問題があり[]?ますか?
[]?
[...]文字クラスと呼ばれる は、1 つの文字に一致します。
[...]
あなたはおそらく欲しい:
(?:0x)?\d+