POV-Ray : Newsgroups : povray.off-topic : Other people dislike regexes too : Re: Other people dislike regexes too Server Time
29 Jul 2024 08:14:47 EDT (-0400)
  Re: Other people dislike regexes too  
From: clipka
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

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