preg match all — Àü¿ª Á¤±Ô Ç¥Çö½Ä ¸ÅÄ¡¸¦ ¼öÇà |
|
|
 |
14³â Àü |
int preg_match_all ( string $pattern , string $subject , array &$matches [, int $flags [, int $offset ]] )
pattern ¿¡ ÁÖ¾îÁø Á¤±Ô Ç¥Çö½ÄÀ¸·Î subject ¿¡¼ ¸ðµç ¸ÅÄ¡¸¦ ã¾Æ³»°í, flags ¿¡ ÁöÁ¤ÇÑ ¹æ¹ý¿¡ µû¶ó¼ matches ¿¡ ³Ö½À´Ï´Ù.
óÀ½ ¸ÅÄ¡°¡ ¹ß°ßµÈ ÈÄ, ÀÌÈÄ °Ë»öÀº ¸¶Áö¸· ¸ÅÄ¡ÀÇ ³¡¿¡¼ºÎÅÍ ÀÌ·ç¾îÁý´Ï´Ù.
[Àμö]
pattern : Ž»öÇÒ ¹®ÀÚ¿ ÆÐÅÏ
subject : ÀÔ·Â ¹®ÀÚ¿
matches : ¸ðµç ¸ÅÄ¡ÀÇ ¹è¿. flags ¿¡ µû¶ó¼´Â, ´ÙÂ÷¿ø ¹è¿.
flags : ´ÙÀ½ Ç÷¡±×µéÀ» Á¶ÇÕÇÒ ¼ö ÀÖ½À´Ï´Ù (PREG_PATTERN_ORDER¿Í PREG_SET_ORDER¸¦ µ¿½Ã¿¡ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù)
- PREG_PATTERN_ORDER : $matches[0] ¹è¿ÀÌ Àüü ÆÐÅÏÀ» °¡Áö°í, $matches[1] ¹è¿ºÎÅÍ °ýÈ£ ¾ÈÀÇ ¼ºê ÆÐÅÏÀ» °¡Áöµµ·Ï °á°ú¸¦ ÁöÁ¤ÇÕ´Ï´Ù
- PREG_SET_ORDER : $matchs[0]°¡ óÀ½ ¸ÅÄ¡ÀÇ ¹è¿À» °¡Áöµµ·Ï ÇÏ°í, $matches[1]°¡ µÎ¹ø° ¸ÅÄ¡ÀÇ ¹è¿À» °¡Áöµµ·Ï °á°ú¸¦ ÁöÁ¤ÇÕ´Ï´Ù.
- PREG_OFFSET_CAPTURE : ÀÌ Ç÷¡±×¸¦ ³Ñ±â¸é, ¸ðµç ¹ß»ýÇÑ ¸ÅÄ¡¿Í ÇÔ²² ¿ÀÇÁ¼ÂÀ» ¹ÝȯÇÕ´Ï´Ù. ÀÌ´Â ¹è¿¿¡¼ matches ÀÇ °ªÀ» º¯°æÇÏ´Â Á¡¿¡ ÁÖÀÇÇϽʽÿÀ. ¹è¿ÀÇ ¸ðµç ¿ø¼Ò´Â ¸ÅÄ¡ÇÑ ¹®ÀÚ¿À» 0 ¿ÀÇÁ¼Â¿¡ °¡Áö°í, ¹®ÀÚ¿ ¿ÀÇÁ¼ÂÀ» 1 ¿ÀÇÁ¼Â¿¡ °¡Áö°Ô µË´Ï´Ù.
Ç÷¡±×°¡ ÁÖ¾îÁöÁö ¾ÊÀ¸¸é, PREG_PATTERN_ORDER·Î Ãë±ÞÇÕ´Ï´Ù.
http://docs.php.net/manual/kr/function.preg-match-all.php |
|
̵̧ : 339 |
̵̧
¸ñ·Ï
|
|