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

  • Posted by Lorem Ipsum someone on March ... \
  • Posted by: On a March ... \ n
  • Posted Someone March ... \ n
  • Posted by Lorem Ipsum on anyone ... ... \ n
  • by On ....
  • Submitted By: On Anyone ... ... \ n
  • Presented by Lorem Ipsum Code> someone ... ... \ n
    • \ n means only the end of the line

      This is what I did, but according to the expectation, the speed is not always to work fast

        / (?: Posted | post | submitted) \ s) (? :( by)) (? :(. *)) \ S (. *) | / I   

      / 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 by string in the beginning, otherwise it will be something like "something like ..."

      updated
        / (by: ^ \ s) | (?. * (?: Post | deposited [T]} (?: Ed) [\ w | s] * by ??? \)) / im>   

      group index 1 will be your post. Submitted | ... and everything else on the left.

      Enter image details here < / Div>

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -