Need Help with regular expression in fetching the last value in Line having line terminators

Hi Team,

Can you please help me in getting the last value of the below string using regex ?

01-Jan-2020 31-Jan-2020 £ 390 - 23 £ 8,970

1 Like

will the format of date remains same?/

@mc00476004, Mention whats the text you are trying to extract.

Also let me know if regex is the only option or alternate solution is acceptable.

The date format will remain the same, I have tried the below, but it is matching two values, but I need only the last value

The Last amount value with the currency symbol, Yes alternative solution is acceptable.

Thank you!

Use the below vb.net function

inputstr.trim.tostring.split("£"c).Last

Use assign, pass the function to right side and get the expected value on the left

1 Like

Hi @mc00476004

You need to use dollar at the end of the pattern
—> \p{Sc}\s*[. \d]+$

1 Like

(?<=\d+\s{1,2}-\s{1,2}\d+\s).*
check this pattern and let me know cheers!
@mc00476004

1 Like

Thank you !

Hi
With Regex
stroutput = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”(\d\W\d+)+$”).ToString.Trim

With split method
Stroutput = Split(strinput.ToString,” “).Last().ToString.Trim

Cheers @mc00476004

1 Like

Pradeep, This is working only for this string but if anything gets added in between this expression does not match. Thank you for your help bud!

1 Like

I used this and this works perfectly fine

Hey Palaniyappan,

Thank you this works fine :slight_smile:

1 Like

Cheers @mc00476004

1 Like