regex function, please help
I know what regex can do but am unable to actually use it, I just do not have the time to learn what I need to implement for an assignment. Can someone please help me.
I need to parse a string. The string has two formats:
The first is: "Useless text I want to get rid of then a £ sign, I want everything that follows and save it as a string, there is no second £ sign
Second is: "Useless text I want to get rid of, also get rid of the first £ and what follows if there is a second £. After second £ take the string after that and save it as a string
The two possible problems I will face will be all structured this way:
"my favourite crisps sell for £2.30"
In the first example I would want to retain "2.30" in a string. In the second example I would like to retain "5.25" in a string.
"my favourite vegetable sell @ £1.05/kg so for 5kg I pay £5.25
I know a clever programmer could just work with the £ sign and do something elegant. Takes this as a challenge from a novice :D