Regular expressions vs find?

David C. Ullrich ullrich at math.okstate.edu
Sun Jun 18 11:44:13 EDT 2000


William Dandreta <wjdandreta at worldnet.att.net> wrote in article
<sy535.11434$Xx5.530580 at bgtnsc06-news.ops.worldnet.att.net>...
> I recently read a message that suggested that using regular expressions
> might be faster than the find function.

	I would have guessed that if anything find would be faster, although
I certainly could be wrong. Did someone say that using a regular expression
would be _faster_, or did they actually say it was more _powerful_ or some 
such?

> I've heard the term regular
> expression used from time to time but I don't know what it means. Could
> someone give me a simple explanation?

	Regular expressions are a way of finding very general sorts of 
"patterns" in text - you could use a regular expression to search for
something like "any number of digits, followed by at least one letter,
only at the end of a line." See the docs on the re module for details.

	(There's at least one whole _book_ on regular expressions,
"Mastering Regular Expressions" or something.)

> Bill
> 
> 
> 



More information about the Python-list mailing list