Simple Regexp for php?

r1ch4r6

New member
Hi everyone, thanks for reading.

I just need a simple regular expression for php preg_match_all. I want to match a keyword and any text(including new lines) that come before the keyword.

the basic idea is: some paragraphs of text, need to match the keyword out of the text and keep everything that came before the keyword.

i have tried preg_match_all("/([.]*[^.]*)($keyword)/iUs", $text, $array)
i also tried other similar ways, but i'm no good at regexp so would appreciate some help.

thanks,

richard.
 
Back
Top