Is str ~ regex the root of all evil, or the leaf of all good?

Derek Parnell derek at psych.ward
Thu Feb 19 13:11:18 PST 2009


On Thu, 19 Feb 2009 07:46:47 -0800, Andrei Alexandrescu wrote:

> Derek Parnell wrote:
>> On Thu, 19 Feb 2009 07:01:56 -0800, Andrei Alexandrescu wrote:
>> 
>>> These all put the regex before the string, something many people would 
>>> find unsavory.
>> 
>> I don't. To me the regex is what you are looking for so it's like saying
>> "find this pattern in that string". 
> 
> Yah, but to most others it's "match this string against that pattern". 

I might not be normal ;-)

> Again, regexes have a long history behind them. So probably we need to 
> have both "find" and "match" with different order of arguments, something .
> 
> Anyway, std.algorithm defines find() like this:
> 
> find(haystack, needle)

I use the Euphoria language a lot, and its routine API is find(needle,
haystack), so I'm sure this is where my normality springs from.


> What is the most natural way?

Get your "personal assistant" to do it.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list