Knute Snortum wrote:I'm not sure that's going to work properly. There is an element
that should be all one element and not be split by the comma. I would look into using a CSV library like
Jamie Zawinski wrote:Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
But isn't ] a regex metacharacter? Would't you have to use "\\]" as a regex?
Swastik Dey wrote:You may split it based on ] . . .
Never knew that; thank you.
Knute Snortum wrote:. . . . So the regex will work.
Piet Souris wrote:In my reply I suggested to use a dedicated class to collect all the fields of a block, and I suggested to converse some strings of a block into more useful types. For instance, if, after splitting a block, we have the fields f1 = "Dec 17" and f2 = "2019 9:00:00 PM", then we can put these into a useful LocalDateTime, with a suitable DateTimeFormatter. I did not tell how that could be done, but here is a way
With this, we can get:
Carey Brown wrote:Most people hate this but I'm going to offer it up anyway because it works. Regular expressions and other lexars generate state machines behind the scenes, this one is just unrolled.
Famous last words. Well, for your use I think it should work but I found and fixed some edge cases. Here's an update.
...because it works...