[REBOL] Re: Perl is to stupid to understand this 1 liner.
From: carl:cybercraft at: 16-Dec-2001 8:01
On 15-Dec-01, Joel Neely wrote:
> IIRC, there was a thread a few months ago about trying to come
> up with a PARSE rule which would recognize phone numbers from
> as many countries as possible with as few errors (false positives
> and false negatives) as possible. As I recall, the result was
> that the range of variation as one added countries with differing
> conventions rapidly made the task infeasible.
Part of the problem is RT's decision to allow 12-12-2001 as a date
datatype along with other forms for dates. If they hadn't
hyphens-in-digits could've been used as a phone datatype, though I
guess there's still places where 4 digits are typical phone numbers.
But then, to-phone would get around that, as with to-decimal 10.
>> rebol[]c: charset "0123456789" parse/all f: read %memo.txt[some
>> [a: 1 2[3 c "-"]4 c b:(change/part a "####" b) | skip]]print f
> Very nice! I find it hard to imagine a shorter solution in REBOL.
>> I couldn't have done it without Petr's example though, as what
>> I was trying wasn't working. (: But I now know a lot more about
>> parsing than I did yesterday...
> And *THAT*, to my way of thinking, is the a real payoff to such
> parlor games as this -- we improve our grasp of what is (or isn't)
> feasible with one tool or another, and learn to use our tool(s)
> better.
Yep.
--
Carl Read