php preg替换为空格和换行符

i have a text (in file with spaces and tabs)

 <tr>
<th width="219" rowspan="2">dsf</th>
<th width="60" rowspan="2">dsfsdf</th>
<th width="135" colspan="2">dsfdsf</th>

  </tr>

and preg replace search

"!  <tr>
    <th width=\"219\" rowspan=\"2\">dsf</th>
    <th width=\"60\" rowspan=\"2\">dsfsdf</th>
    <th width=\"135\" colspan=\"2\">dsfdsf</th>
  </tr>!is",

it's not my regular expression, but client say that it works before, after some research i'm found that is some problem with spaces or new line /n. If i trying find only one string it's work. I'm tying add /r/n nothing help. Maybe somebody can help me

Just use \s+ when looking for any whitespace. It's the cheap and easy way out.

<tr>\s+<th width=\"219\" rowspan=\"2\">dsf</th>\s+<th width=\"60\" rowspan=\"2\">dsfsdf</th>\s+<th width=\"135\" colspan=\"2\">dsfdsf</th>\s+</tr>

See this regex101 link for an example.