[Python-Dev] why we have both re.match and re.string?
Michel Desmoulin
desmoulinmichel at gmail.com
Wed Feb 10 17:52:48 EST 2016
More information about the Python-Dev mailing list
Wed Feb 10 17:52:48 EST 2016
- Previous message (by thread): [Python-Dev] why we have both re.match and re.string?
- Next message (by thread): [Python-Dev] why we have both re.match and re.string?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, Le 10/02/2016 22:59, Luca Sangiacomo a écrit : > Hi, > I hope the question is not too silly, but why I would like to > understand the advantages of having both re.match() and re.search(). > Wouldn't be more clear to have just one function with one additional > parameters like this: > > re.search(regexp, text, from_beginning=True|False) ? Actually you can just do re.search(^regexp, text) But with match you express the intent to match the text with something, while with search, you express that you look for something in the text. Maybe that was the idea? > > In this way we prevent, as written in the documentation, people > writing ".*" in front of the regexp used with re.match() > > Thanks. > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/desmoulin.michel%40gmail.com
- Previous message (by thread): [Python-Dev] why we have both re.match and re.string?
- Next message (by thread): [Python-Dev] why we have both re.match and re.string?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list