I am new to F # but have spent the past few weeks reading reference materials. I want to process a user input line by identifying and separating the constituent elements. For example, for this input:
XYZ Hotel: 6 nights at 220EUR / night plus 17.5% tax
the output should resemble something like a list of tuples:
[("XYZ", Word); ("Hotel:", Word),
("6", "Room"); ("nights", "Word"),
("at", Operator); ("220", number),
("EUR", CurrencyCode); ("/", Operator); ("night", "Word"),
("plus", "Operator"); ("17.5", Number); ( "%", Percent); ("Tax", Word)]
Since I'm dealing with user input, it could be anything. Thus, the expectation that users abide by grammar is out of the question. I want to identify numbers (there may be integers, floats, negative ...), units of measurement (optional, but may include SI or imperial physical units, currency codes such as "night / s" in my example), mathematical operators (like mathematical symbols or words, including "by", "for", "from", "discount", etc.) and all other words.
I got the impression that I should use active pattern matching - is that right? - but I'm not quite sure how to start. Any pointers to relevant reference material or similar examples would be great.