Я извлекаю индексы слов, которые соответствуют в этом регулярном выражении . Он сопоставляет все необходимые слова в тексте с помощью регулярных выражений, но также соответствует пробелу слева от регулярных выражений. Это не ограничивающая совпадающая строка в тексте с левой стороны, но ограничивающая правую сторону сопоставляемой строки с помощью \b
Regex:
(price|rs)?\s*(\d+[\s\d.]*\s*?(pkg|k|m|(?:la(?:c|kh|k)|crore|cr)s?|l)\b\.?)
Введите текст:
This should matchprice 5.6 lacincluding price(i.e price 5.6 lac) and rs 56 m. including rs (i.e rs 56 k rs 56 m) .
It will match normally if there is no price or rs written for example or 56 k or 8.8 crs. are correct matching but its should bound the matched string from left side as well just like its not matching sapce after end of the matched string.
It should not match the spaces left of 8.5 in this 8.5 lac ould not match eitherrs 6 lac asas there is no spaces before 5.6
How can I modify above regex to bound the matched word in the left side as well?