我使用下面的正则表达式来处理下面的文本
正则表达式:
[\s](rs|price)?([\s.]*\d+[\s\d.]*)(pkg|k|(?:la(?:c|kh|k)|crore|cr)s?|l)[\s.]
文本:
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.
它的价格与上面提到的不完全相符,但只有很少的。我匹配的价格前后有空格的价格正则表达式完全匹配。
我补充说
[\s.]
最后以匹配价格而告终。后面有空格。例如55个crs。或24拉丁美洲。类似地,我添加了“[\s]”,以便只匹配那些在匹配价格之前有空格的价格。
输出:
https://regex101.com/r/iHamwk/1/
示例输出2:
https://regex101.com/r/h8NLhr/5
示例输出3:
https://regex101.com/r/h8NLhr/8
又怎样才能提取出只排除前后空格的匹配价格呢?
谢谢。