Regexp (ereg) help

From: Date: Thu, 24 Jul 2003 21:41:13 +0000
Subject: Regexp (ereg) help
Groups: php.general 
Request: Send a blank email to php-general+get-156746@lists.php.net to get a copy of this message
Hi all, If I have the following string: $str = "This is a %ANS[1] test, and %ANS[2] test, and %ANS[10], test" and want to use ereg($pattern, $str, $regs); what is the $pattern should be so that in $regs I have $regs[1] == "%ANS[1]"; $regs[2] == "%ANS[2]"; $regs[3] == "%ANS[10]"; .. In fact, the $pattern should general enough that $regs will be filled with anything that has the pattern %ANS[X] where X could be any number in any digits (eg. 1,2,10,100,23, etc). Thanks for any help. RDB -- ------------------------------------------------- /"\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ ------------------------------------------------- Have you been used by Microsoft today? Choose your life. Choose freedom. Choose LINUX. -------------------------------------------------

« previous php.general (#156746) next »