I am try use
(?<key>.{5}keyword.{5}?)
to test "other string keyword other text"
it will get "ring keyword othe"
and I want "akeyword other text" or "other string keyworda" or "akeywordc" are match, too.
How to modify regex?
I have a long string and I want get find keyword and get it with perfix and suffix string
demands 5 just a sample it may change to any number like 50
my question is if the keyword's position less than 5 and it's not match.
how to get perfix or suffix string with keyword when perfix or suffix string length is
unknow.
Sorry, my question is not clear.
I want get get perfix or suffix string with keyword. and I want get prefix or sufiix string at most 5 word.
example:
"abcde keyword abcde" I want get "bcde keyword abcd"
and when prefix string less then 5 word
"a keyword abcde" I want get "a keyword abcd"
or suffix string less then 5 word
"abcd keyword a" I want get "abcd keyword a"