php - regex - match "(posted|post|submitted) by:" from a text -
I need to match & amp; Replace with each type of string with a string:
Note: Each string can be in a text or at the beginning of the text; In both cases, regex should get everything from the starting point to the end of the line This is what I did, but according to the expectation, the speed is not always to work fast / edit: OK, I need to match the problem at the beginning of the string and in the middle < Code> Posted is submitted, and by the group index 1 will be your post. Submitted | ... and everything else on the left.
Posted by: On a March ... \ n
Posted Someone March ... \ n
on anyone ... ... \ n
by On ....
Submitted By: On Anyone ... ... \ n
Code> someone ... ... \ n
\ n means only the end of the line
/ (?: Posted | post | submitted) \ s) (? :( by)) (? :(. *)) \ S (. *) | / I
by string in the beginning, otherwise it will be something like "something like ..."
updated
/ (by: ^ \ s) | (?. * (?: Post | deposited [T]} (?: Ed) [\ w | s] * by ??? \)) / im>
< / Div>
Comments
Post a Comment