how to avoid leading white spaces

Chris Angelico rosuav at gmail.com
Sat Jun 4 02:04:18 EDT 2011


On Sat, Jun 4, 2011 at 12:30 PM, Roy Smith <roy at panix.com> wrote:
> Another nice thing about regexes (as compared to string methods) is that
> they're both portable and serializable.  You can use the same regex in
> Perl, Python, Ruby, PHP, etc.  You can transmit them over a network
> connection to a cooperating process.  You can store them in a database
> or a config file, or allow users to enter them on the fly.
>

I wouldn't ever be transmitting them around the place, unless also
allowing users to enter them. But I have done exactly that - a
validator system that lets you put a header with a regex, and then
string content below that. That IS one advantage of the regex.

However, that's a very VERY specific situation. If I'm not asking a
third party to provide the match condition, then that's not a reason
to go regex.

Chris Angelico



More information about the Python-list mailing list