Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Newbie help: Parsing mobile email address

From: al:bri:xtra at: 11-Jun-2002 18:45

> I'm wondering if there's a more efficient way to do it (shortcuts in
REBOL)
> Basically I'm trying to do this... > > Mobile Email Address: [4165551234--pcs--rogers--com] > > <Parsing algorithm> > > Result: > ~~~~~~~~~~~~~~~~~~~~~~~ > Area Code: 416 > Phone Number: 5551234
Digit and Alpha are defined by one of my scripts:
>> Digit
== make bitset! #{ 000000000000FF03000000000000000000000000000000000000000000000000 }
>> Alpha
== make bitset! #{ 0000000000000000FEFFFF07FEFFFF0700000000000000000000000000000000 }
>> M: [4165551234--pcs--rogers--com]
== [4165551234--pcs--rogers--com]
>> parse M [
[ copy Area_Code 3 digit copy Telephone 7 digit #"@" [ [ some alpha some [#"." some alpha] [ ] [ end [ ] == true
>> Area_Code
== "416"
>> Telephone
== "5551234" I hope that helps! Andrew Martin ICQ: 26227169 http://valley.150m.com/