...or is this just me? Let's take a look, Reference Lib, 4.2.1 Regular Expression Syntax says: "|" A|B, where A and B can be arbitrary REs, creates a regular expression that will match either A or B. [...] REs separated by "|" are tried from left to right, and the first one that allows the complete pattern to match is considered the accepted branch. This means that if A matches, B will never be tested, even if it would produce a longer overall match. [...] And now a little test: import re a = "Fuentes Rushdie Marquez" print re.search("Rushdie|Fuentes", a).group() # returns "Fuentes" According to the documentation I suspected it will return "Rushdie" rather than "Fuentes", but it looks like it returns first part of the string that matches rather than first part of regular expression. -- [ Wojtek Walczak - gminick (at) underground.org.pl ] [ <http://gminick.linuxsecurity.pl/> ] [ "...rozmaite zwroty, matowe od patyny dawnosci." ]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4