|
![](/i/fill.gif) |
>>>>> dmesg | egrep '(s|h)d[a-z]'
>>>>
>>>> If you want to build your straw man, at least use examples that conform
>>>> to your straw man. That's a bad example because it can be understood in
>>>> about 2 seconds.
>>
>>> OK, so what does it do?
>>
>> I can't believe that you are arguing that a regex is complicated because
>> you have never used regexes and don't understand their syntax.
>>
>> Imagine this:
>>
>> A: "Haskell sucks. It's really hard to understand!"
>> B: "How much Haskell have you ever written?"
>> A: "I once tried to write one small program but couldn't figure it out."
>> B: "Right."
>>
>> Don't complain about the complexity of a syntax if you haven't even
>> learned the syntax.
>
> Imagine if instead, somebody had written
>
> oneOf "sh"
> char 'd'
> letter
>
> You don't even need to know which parsing library or what programming
> language this is to figure out that it matches three characters. (Or
> maybe do you. It's perhaps not /completely/ obvious what the final line
> does.) There's barely anything to learn.
Actually it's not obvious that the three statements are actually
supposed to be applied to the same string or that it must match all three.
It might be a tad more readable than a regular expression, but it's not
inherently more obvious what it does. Having nothing but english words
instead of various puctuation signs does not guarantee clarity. Case in
point:
=IF(AND(OR(UPPER(LEFT(A1,1))="S"),UPPER(LEFT(A1,1))="H"),UPPER(MID(A1,2,1))="D",NOT(ISERROR(SEARCH(MID(A1,3,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")))))
(I hope I didn't mess up my parentheses!)
>
> It's a lot more typing, of course. But personally, that doesn't bother me.
>
>>> Come on, regexes are the number one use-case for the entire Perl
>>> programming language.
>>
>> If you want to complain about perl, then complain about perl.
>
> Have I ever mentioned that I also really hate Perl?
>
> Of course, the only reason that anybody ever uses Perl is because it has
> built-in regex support. This, together with low-level text munging, is
> literally ALL PERL DOES! >_<
Yes, and a all a hammer does is push (and in some cases pull) on nails.
It doesn't mean that a hammer is not useful, or the best tool for that
particular job.
Text munging is a big part of many people's lives. (If you consider
sysadmins to be people, of course)
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
![](/i/fill.gif) |