Re: Need help with a regular expression
| From: | Ryan Dingman | Date: | Thu, 30 Sep 2004 22:53:05 +0000 |
| Subject: | Re: Need help with a regular expression | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198361@lists.php.net to get a copy of this message | ||
On Sep 30, 2004, at 2:22 PM, Alex Hogan wrote:
Is my ereg() wrong? My understanding is ereg("^Q4_.[0-9]$", $key) should look for a $key starting with 'Q4_' followed by a single number and place those values into an array named $Q4scores.Yes, your understanding of "^Q4_.[0-9]$" is wrong. This says that you are looking for a string with the following properties: 1. Anchored at the beginning 2. Begins with "Q4_" 3. Followed by any single character (except newline) 4. Followed by any single digit 5. Anchored at the end If you remove the "." in the middle of your pattern, you should get what you are looking for. Hope this helps. ryan