PHP multiple preg_replace with multiple Regex conditions?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saibot
    New Member
    • Mar 2021
    • 1

    PHP multiple preg_replace with multiple Regex conditions?

    I want a expression that replaces more than 2 newlines and more than 4 spaces with 2 newlines / 1 space.

    Now I have a working regex expression: "{5,}|^\n{2 ,}":

    But now I have a problem: In PHP I have to say what I want it to replace with and as I have multiple replaces I have to have multiple preg_replaces.

    Could anyone please make a preg_replace with the regex above and replace it with the statements above? (I dont know that much Regex, sorry)

    Thanks very much!
    Best reguard,
    Tobi
Working...