Python regex matches string it shouldn't -
I am completely lost how it matches this string in the regx dragon. Can anyone feel it?
import re regex = "^ PHP / 5. \\ {3 | 2 \\}. \\ {1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 \\} \\ {1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 \\} $ "ua = 'Mozilla / 5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident / 5.0) 'Recompens'. Search starts with (UAE)
rijax php
, while the string does not exist. Should not a match be made unqualified by this happening? You need grouping (preferably non-capturing) Your Promotion:
PHP / 5 \\ {(?: 3 | 2) \\} \\ {(?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |) | \\} \\ {(?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | | 9 | 0) \\} $ ^ ^ ^ ^ ^ ^
Other intelligent you will change the entire expression:
-
PHP / 5
or -
2
or -
\ \}. \\ {1
or -
2
or -
3
or -
4
or -
5
Found!
Think and nested conditions ( if (a and amp;)
). < / Em>
Comments
Post a Comment