POV-Ray : Newsgroups : povray.off-topic : Other people dislike regexes too Server Time
29 Jul 2024 06:13:49 EDT (-0400)
  Other people dislike regexes too (Message 23 to 32 of 32)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Francois Labreque
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 11:05:01
Message: <5008221d$1@news.povray.org>


>
>
=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!)

I didn't mess up my parentheses, but forgot to put

,"Hard disk is on fire",""

before the last parenthesis.

-- 
/*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

From: Orchid Win7 v1
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 12:27:28
Message: <50083570@news.povray.org>
> Having nothing but english words
> instead of various puctuation signs does not guarantee clarity.

No. But it can help a lot. I won't have to go look up what my code 
snippet does if I come back to it in 6 months' time.

>> 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)

The thing is, text munging is fundamentally /wrong/. It's something that 
should be avoided at all costs. So an entire language designed to 
perform a task that you shouldn't perform in the first place...


Post a reply to this message

From: Darren New
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 14:58:24
Message: <500858d0@news.povray.org>
On 7/19/2012 3:53, Invisible wrote:
> 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.

Really? I would not have guessed that "one of sh" means "one of the 
characters in the string" vs "one instance of the string 'sh'"

> 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! >_<

It's a report generation language. It's right in the name. What did you 
expect? Did you ever read any RPG (Report Program Generator) code?

-- 
Darren New, San Diego CA, USA (PST)
   "Oh no! We're out of code juice!"
   "Don't panic. There's beans and filters
    in the cabinet."


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 15:34:23
Message: <5008613f$1@news.povray.org>
>> 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.
>
> Really? I would not have guessed that "one of sh" means "one of the
> characters in the string" vs "one instance of the string 'sh'"

OK. So it's not completely trivial. Easier than trying to guess what 
"[s|h]" is meant to mean though. :-P

>> 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! >_<
>
> It's a report generation language. It's right in the name.

Funny, I could have sworn I already /said/ that. ;-)


Post a reply to this message

From: clipka
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 17:30:08
Message: <50087c60$1@news.povray.org>
Am 19.07.2012 21:34, schrieb Orchid Win7 v1:
>>> 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.
>>
>> Really? I would not have guessed that "one of sh" means "one of the
>> characters in the string" vs "one instance of the string 'sh'"
>
> OK. So it's not completely trivial. Easier than trying to guess what
> "[s|h]" is meant to mean though. :-P

Nonsense. First of all it's "(s|h)". Now, the parentheses should be no 
problem to decipher for anyone familiar with the basics of mathematics: 
There, it is used to override operator precedence by grouping parts of 
the term into a sub-term. Same in RegExes; it should be pretty easy to 
come to the presumption that "(s|h)" means "a group of characters that 
matches 's|h'".

Now for the "|", this is quite a well established symbol for an "or" 
operation in various languages (e.g. C, POV-Ray SDL, etc.). With this in 
mind, it's a matter of seconds to realize that "s|h" might mean "'s' or 
'h'".


Post a reply to this message

From: Tim Cook
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 18:04:33
Message: <50088471$1@news.povray.org>
On 2012-07-19 16:30, clipka wrote:
> Now for the "|", this is quite a well established symbol for an "or"
> operation in various languages (e.g. C, POV-Ray SDL, etc.). With this in
> mind, it's a matter of seconds to realize that "s|h" might mean "'s' or
> 'h'".

And the "s|h" form is visually similar enough to the more-common 
"and/or" that even if you didn't happen to know that | meant 'or', you'd 
have a better-than-zero chance of guessing its intent.

(So what is the result of &/| anyways?)

--
Tim Cook
http://empyrean.sjcook.com


Post a reply to this message

From: clipka
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 18:14:41
Message: <500886d1$1@news.povray.org>
Am 20.07.2012 00:04, schrieb Tim Cook:
> On 2012-07-19 16:30, clipka wrote:
>> Now for the "|", this is quite a well established symbol for an "or"
>> operation in various languages (e.g. C, POV-Ray SDL, etc.). With this in
>> mind, it's a matter of seconds to realize that "s|h" might mean "'s' or
>> 'h'".
>
> And the "s|h" form is visually similar enough to the more-common
> "and/or" that even if you didn't happen to know that | meant 'or', you'd
> have a better-than-zero chance of guessing its intent.
>
> (So what is the result of &/| anyways?)

Related question: 2b|!2b?


Post a reply to this message

From: James Holsenback
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 18:57:20
Message: <500890d0$1@news.povray.org>
On 07/19/2012 06:14 PM, clipka wrote:
> Related question: 2b|!2b?

LOL ... clever and thought provoking at the same time


Post a reply to this message

From: Kevin Wampler
Subject: Re: Other people dislike regexes too
Date: 19 Jul 2012 20:59:18
Message: <5008ad66$1@news.povray.org>
On 7/19/2012 3:14 PM, clipka wrote:
>
> Related question: 2b|!2b?

True, very true.


Post a reply to this message

From: Warp
Subject: Re: Other people dislike regexes too
Date: 20 Jul 2012 01:14:27
Message: <5008e932@news.povray.org>
Orchid Win7 v1 <voi### [at] devnull> wrote:
> >> 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.
> >
> > Really? I would not have guessed that "one of sh" means "one of the
> > characters in the string" vs "one instance of the string 'sh'"

> OK. So it's not completely trivial. Easier than trying to guess what 
> "[s|h]" is meant to mean though. :-P

Your complaint seems to be that the meaning of regexes may be hard to
guess for somebody who does not know their syntax. That's an inane
complaint.

I tried to explain that in my previous post, but seemingly you didn't
understand.

-- 
                                                          - Warp


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.