R
Robert Crandal
My input data strings have roughly the following format:
"Item1 scissors"
"Item2 two notebooks"
"item3"
"itm4 keyboards and scissors"
"item_5 glue,paper,scissors"
My strings begin with an "item number" string followed by a
description of the item(s). It is possible that an item description
could be missing, as seen in "item3" above. (Assume that the
"item number" token will always be present)
What is a good regular expression that I can use to save the
item number in a variable named "$ItemNum" and save the
description in a variable named "$Description"?? (If the
description string is missing I want the "$Description" variable
to be set to the empty string.
Thank you.
"Item1 scissors"
"Item2 two notebooks"
"item3"
"itm4 keyboards and scissors"
"item_5 glue,paper,scissors"
My strings begin with an "item number" string followed by a
description of the item(s). It is possible that an item description
could be missing, as seen in "item3" above. (Assume that the
"item number" token will always be present)
What is a good regular expression that I can use to save the
item number in a variable named "$ItemNum" and save the
description in a variable named "$Description"?? (If the
description string is missing I want the "$Description" variable
to be set to the empty string.
Thank you.