I am using following regex for following kind of text below
Regex: [\s](rs|price)?([\s.]*\d+[\s\d.]*)(pkg|k|(?:la(?:c|kh|k)|crore|cr)s?|l)[\s.]
Text:
65 lac this is 55 lac. and more price 100 lac. randome text to test price45 crs. and 65 cr and to test its matching rs 3244 k like rs 55k. to its matchibg 65 cr. but not 65 cr als not matching price 123 lac more of it 55 crs.
Its not matching all of the price mentioned above but only few. I am matching price which have spaces before and after of prices regex full match.
I have added [\s.]
at the end to match prices which also ends with . andhave spaces after it. For e.g like 55 crs. or 24 lac. Similarly I have add '[\s]' to match only those price which have space before matched price.
Output:
https://regex101.com/r/iHamwk/1/
Example output 2: https://regex101.com/r/h8NLhr/5
Example Output 3: https://regex101.com/r/h8NLhr/8
How should I modify above regex ?
Also how can extract matched prices only excluding spaces before and after it?
Thanks.