Names Default To Here(1);
rgx_parse = function({str}, {Default Local},
// new_str = Regex(str, "\|.+?\)", "", GLOBALREPLACE);
new_str = Regex(str, "\|(.[^)]{0,})\)", "", GLOBALREPLACE);
return(new_str);
);
words_parse = function({str}, {Default Local},
mylist = Words(str, "\!N");
comparisons = Transform Each({line}, mylist,
Word(1, line, "|");
);
result = Concat Items(comparisons, "\!N");
);
mystr1 = "\[BPS<4.05|is Missing(BPS)
BPS>=2.75
ab>=1961734|is Missing(ab)
efg<13741
]\";
mystr2 = "\[BPS<4.05|is Missing(BPS)
BPS>=2.75|
ab>=1961734|is Missing(ab)
efg<13741
]\";
mystr3 = "\[BPS<4.05|is Missing(BPS)
BPS>=2.75|)abc
ab>=1961734|is Missing(ab)
efg<13741
]\";
Show(rgx_parse(mystr1));
Show(words_parse(mystr1));
write("\!N");
Show(rgx_parse(mystr2));
Show(words_parse(mystr2));
write("\!N");
Show(rgx_parse(mystr3));
Show(words_parse(mystr3));
write("\!N");
Names Default To Here(1);
rgx_parse = function({str}, {Default Local},
// new_str = Regex(str, "\|.+?\)", "", GLOBALREPLACE);
new_str = Regex(str, "\|(.[^)]{0,})\)", "", GLOBALREPLACE);
return(new_str);
);
words_parse = function({str}, {Default Local},
mylist = Words(str, "\!N");
comparisons = Transform Each({line}, mylist,
Word(1, line, "|");
);
result = Concat Items(comparisons, "\!N");
);
mystr1 = "\[BPS<4.05|is Missing(BPS)
BPS>=2.75
ab>=1961734|is Missing(ab)
efg<13741
]\";
mystr2 = "\[BPS<4.05|is Missing(BPS)
BPS>=2.75|
ab>=1961734|is Missing(ab)
efg<13741
]\";
mystr3 = "\[BPS<4.05|is Missing(BPS)
BPS>=2.75|)abc
ab>=1961734|is Missing(ab)
efg<13741
]\";
Show(rgx_parse(mystr1));
Show(words_parse(mystr1));
write("\!N");
Show(rgx_parse(mystr2));
Show(words_parse(mystr2));
write("\!N");
Show(rgx_parse(mystr3));
Show(words_parse(mystr3));
write("\!N");