답변 2개
채택된 답변
+20 포인트
2017-09-26 (화) 18:39:25
http://php.net/manual/en/regexp.reference.escape.php
\s
any whitespace character
Copy
<?php$match01 = [];$text01 = '<span> 홍길동 </span> <span> 홍 길 동 x </span><span>홍길동</span>';preg_match_all('`<span>\s*([^\s].+)\s*</span>`isU', $text01, $match01);print('<pre>');print_r($match01);print('</pre>');?>
또는 나온 결과물에서 trim으로 좌우공백 날려주셔도 됩니다.
답변을 작성하려면 로그인이 필요합니다.