[REBOL] Bug in Parse result?
From: brock:kalef:innovapost at: 7-Apr-2008 14:10
I'm using view version REBOL/View 1.3.2.3.1 5-Dec-2005 Core 2.6.3
I have the a text file that is tab delimited. I read/lines the data
file which presents the data as shown below if I was to 'probe each line
to the console in a loop;
{7028482^-AVERY, BEVERLY^-86002437^-HILLVIEW}
{7005546^-AVERY, CONNIE^-86511102^-CRYSTAL CITY}
{7021917^-AVERY, MICHELLE^-86000868^-CATALINA}
{7008485^-AVERY, SHEILA^-86002437^-HILLVIEW}
The below code clips have been in use in a monthly data scrub for many
months, approximately a year.
reformat-name: func [name][ ;called by below foreach loop
if not none? name[
replace name ", " tab ;this is the line that isn't being
processed
replace/all name {"} ""
]
return name
]
foreach d data[
parse/all d [
thru {^-} begin: copy employee to {^-} ending:
(
either not none? employee [
new-name: reformat-name employee ;call to the reformat-name
function
change/part begin new-name ending
repend dest-data [d newline]
][
repend excluded [d newline]
]
)
to end
]
]
Essentialy this code simply loops through each data record, changes the
employee names so that the first and last name are tab delimited instead
of CSV. However, it seems the below line is no longer working;
replace name ", " tab
Doing some investigation shows that a search for " " or #" " (a space
string or character) within the string returns 'none.
However if I type do a replace "AVERY, BEVERLY" ", " tab from the
command-line the replace works just fine. So, it seems there is a
problem with the resulting string in that I cannont do a find that
contains a space.
Can anyone confirm this is a bug? I can provide the data file (approx
200kb) and the script I am using for anyone else who wants to confirm
the behaviour in newer views.