Python sqlite and regex.

Dan Sommers me at privacy.net
Fri May 19 19:47:21 EDT 2006


On Fri, 19 May 2006 18:52:38 GMT,
"Paul McGuire" <ptmcg at austin.rr._bogus_.com> wrote:

> "Dan Sommers" <me at privacy.net> wrote in message
> news:m2u07lq2s5.fsf at unique.fqdn...

>> Doesn't SQL already have lightweight wildcards?
>> 
>> SELECT somefield FROM sometable WHERE someotherfield LIKE '%foo%'

> Yes it does - '%' is like '*', and '_' is like '?'.  But it is rare
> for application users to be familiar with these.  In my experience,
> users are more likely to have seen '*' and '?'.

> The reason I keep citing end/application users, as opposed to
> developers ...

Users, application users, end users, etc., vary over time.  Since this
is c.l.p., though, we'd better just agree to disagree over which user(s)
may or may not be familiar with which (or any) wildcard conventions.

> ... the case where the user has filled in some kind of wildcard search
> field, to be passed to SQL in a query.  Woe to the app designer who
> figures that users want to enter a regular expression in such a field
> ...

Woe to the app designer who fails to target the app to the users, make
it clear to the users what is expected in any given field, and accept
"constructive criticism" from unhappy users.  ;-)

Knowing your users is one of the most important factors in software
design.

> ... '%' and '_' wildcards a little better, but frankly, I think '*'
> and '?' looks more like a wildcards than '%' and '_'.

Ah, but then you're not an end user, are you?  ;-)

Regards,
Dan

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>
"I wish people would die in alphabetical order." -- My wife, the genealogist



More information about the Python-list mailing list