<?php $text = '내 이름은 [김똥개]입니다. 나이는 [10살]입니다.'; preg_match_all("/\[[^\]]*\]/", $text, $matches); print_r($matches); /* Array ( [0] => Array ( [0] => [김똥개] [1] => [10살] ) ) */ preg_match_all("/\[([^\]]*)\]/", $text, $matches); print_r($matches); /* Array ( [0] => Array ( [0] => [김똥개] [1] => [10살] ) [1] => Array ( [0] => 김똥개 [1] => 10살 ) ) */