|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |