I’ve got the following text with a variable whitespace at the beginning:
Total Saving: 84%
I’m having trouble getting a match. From what I have learnt so far (new to regex). This should be close to working (I only need to match on either side of the text):
[\s]* Total Saving: [0-9%]*
What am I doing wrong?
You haven’t specified a capturing group to hold the result, and the percent sign
%should not occur more than once in the string.\s*Total Saving:\s*([0-9]+)%(a bit more flexible on the whitespace in the middle) – the first group will contain the actual percentage.