I am new to Python and I do not know regular expressions in Python. Here is the question. I have a sentence like “Total Cost: 37” in stdout, I want to extract the cost info which is 37. When I match the words “Total Cost: ” in a specific line how should I get the rest of the line which is the info that I am interested in?
Share
use
regex:Total Cost:\s?explanation:“Total Cost”: Match the literal
Total Cost:\s?:1 to 0 times Whitespace [\t \r\n\f]Capturing group
([-+]?\d+):[-+]?:1 to 0 times matches one of the following chars: -+\d+:infinite to 1 times Digit [0-9]