Need help to understand the folowing regex

jxdvzjnywf

New Member
i wrote a regex, but it doesn't work as i expect. Take a look please\[code\]preg_match_all("/([\.\:]?)(.{0,65}?[^\s]*".preg_quote($word)."[^\s]*.{0,65})/siu",$content,$matched);\[/code\]\[code\][^\s]*".preg_quote($word)."[^\s]\[/code\]// this part match the whole word, if it contain the keyword, for example it match keyword if i search for wor keyword.\[code\].{0,65}?[^\s]*".preg_quote($word)."[^\s]*.{0,65}\[/code\]here i get up to 65 characters before and after the keyword, ie. i will get many words here keyword and other words hereAnd now, what is the problem. I try to match the sentence from the begining, if there is any of [.:] characters within {65} charactersif i have sach structure - word1 word2 . {less then 65 character here} keyword {other characters here}i expect, then if i wrote \[code\]([\.\:]?)(.{0,65}?[^\s]*".preg_quote($word)."[^\s]*.{0,65})\[/code\]it will match \[code\].{less then 65 character here} keyword {65 characters}\[/code\]but it doesn't. the part \[code\][\.\:]?\[/code\] hasn't any influence on regex. it match all {65} characters.i need to match sentence from begining, if the start of sentence within 65 characters before the keyword Thanks much
 
Back
Top