[PHP] Re: Regex error
Get The Regex Coach http://weitz.de/regex-coach/ Use preg_match_all() Build your pattern one step at a time using the coach. Don't forget the delimiters. jekillen wrote: Hello; The following regex: ereg(member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})' id='$m[1]', $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 Can someone tell me what this means? What I am trying to do is pick out some info from an xml tag the is id'd by $m[1] ( a match from a preceding regex. This regex is only supposed to be applied if there is an $m[1] match. This happened without the dot (.) and forward slash escaped in the uspace=' etc ' section. I used back slashes to see if that made a difference, it does not. I have gotten a little hazy on what needs to be escaped in character classes. I have written a number of similar regexs in the same collections of scripts and I can not see what this one is complaining about. php v5.1.2, Apache 1.3.34, FreeBSD v6.0 Thanks in advance Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] re regex error
Hello again; Regarding the error I was inquiring about: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 I still would like to know what it means but I solved the script problem. I found that since $groups is a string that was exploded to form the $g_list array it may have been struggling to try and crawl back through the whole string in the middle of the for loop. But I don't know, because I don't know what REG_ERANGE means. I should have not been trying to run this regex at this stage of the script and, in fact (I have been doing a lot of complex programming on this project ) I had the same regex further down the list where is should have been and was already. Anyhow, I think this may be valuable for anyone who is trying to learn by watching and reading this list. thanks Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re regex error
jekillen wrote: Hello again; Regarding the error I was inquiring about: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 I still would like to know what it means but I solved the script problem. I found that since $groups is a string that was exploded to form the $g_list array it may have been struggling to try and crawl back through the whole string in the middle of the for loop. But I don't know, because I don't know what REG_ERANGE means. I should have not been trying to run this regex at this stage of the script and, in fact (I have been doing a lot of complex programming on this project ) I had the same regex further down the list where is should have been and was already. Anyhow, I think this may be valuable for anyone who is trying to learn by watching and reading this list. thanks Jeff K was not the answer to your question already given to you in one of your previous posts about this problem? If you didn't get it, here it is again. quote You used to have the - after the 9 at the end, and then you tacked on the \. and \/ after that, and now PCRE is trying to use the - as if it were a range-specifier, like, a-z or 0-9, only you've got, essentially, a-z0-9-. quote -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php