in reply to Re: Regular Expression Trick (Don't use one!)
in thread Regular Expression Trick
Well, your method uses regular expressions too, they're just arguments to the split() routine. BTW, your second split won't work quite right as | is special in regular expressions and the first argument to split is always a regular expression (except for the one special case of ' ').
Also, it appears from the problem description that a pipe symbol also separates individual records, so your solution won't quite do the right thing anyway. But, I suspect that the original poster left something out when he said The only constant is the placement of the "::" and the "|".
as it looks like the number of things is also constant (otherwise why use such a restrictive RE?). So, it may be that a plain-jane pattern match with captures is the Right Way for this particular problem.
|
|---|