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

[REBOL] Re: Perl is to stupid to understand this 1 liner.

From: carl:cybercraft at: 16-Dec-2001 0:44

On 15-Dec-01, Tom Conlin wrote:
> Hmmm > While playing with a one liner for this thread I came across a > disturbing difference between core on Solaris and Win. > here I have split the offending line with a print to see what was > happening; > > --><-- > > d: charset{#{0}-#{9}}a: complement d parse m: read %foo r:[any a p: > (print copy/part :p 8) > opt[3 d{-}4 d(change/part :p {###-####} 8)any r]skip any r] > --><--
On Amiga I get the same results as Solaris. I at first thought it might've been an end-of-line problem, but it somehow doesn't look like that, though have you tried read/string or any other of the likely 'read refinements? And are you sure the scripts are exactly the same, along with the text-files?
> using the same text (from below) > on win it works fine, on solaris it fails badly > on windows ... > 555-1212 > 800-555- > 00-555-1 > 0-555-11 > 555-1111 > 17.3 as > 7.3 as > w > 3 as > we > 123-4576 > 987-6543 > 111-1111 > on solaris ... > -1212 ab > 00-555-1 > 0-555-11 > -555-111 > -1111) o > -4576, h > 987-6543 > -6543, o > -1111. > S > >> SUPPOSE that I have a memo containing phone numbers. I need to give >> someone a copy of the memo, but need to blot out the phone numbers, >> in the best CIA tradition. ;-) Here's the memo: >> 8<---------- >> Ms. Antoinette, >> I spoke with George Washington at 555-1212 about our pending >> contract. He referred me to Ben Franklin (800-555-1111) of >> their technical support department. Ben said that they were >> testing their latest release on WhizBangOS version 17.3 as >> we had requested, and that he would have our answer tomorrow. >> Ben also said that their lead developer, Betsy Ross, would >> like to talk to you about the use of complex numbers in the >> SystemSleepFor function. You may call her office at >> 123-4576, her cell phone at 987-6543, or page her at 111-1111. >> She is very eager to describe this new feature. >> Sincerely, >> Thomas Paine >> 8<---------- >> I can protect everybody's phone numbers from lurking telemarketers >> with the following one-liner in Perl: >> 8<---------- >> # perl -p -e 's/\b(\d{3}-)?\d{3}-\d{4}/####/g' memo.txt >> Ms. Antoinette, >> I spoke with George Washington at #### about our pending >> contract. He referred me to Ben Franklin (####) of >> their technical support department. Ben said that they were >> testing their latest release on WhizBangOS version 17.3 as >> we had requested, and that he would have our answer tomorrow. >> Ben also said that their lead developer, Betsy Ross, would >> like to talk to you about the use of complex numbers in the >> SystemSleepFor function. You may call her office at >> ####, her cell phone at ####, or page her at ####. >> She is very eager to describe this new feature. >> Sincerely, >> Thomas Paine >> 8<---------- >> Anyone is welcome to propose a minimalist solution in REBOL! >> -jn- >> -- >> To unsubscribe from this list, please send an email to >> [rebol-request--rebol--com] with "unsubscribe" in the >> subject, without the quotes.
-- Carl Read