muhjum Posted August 19, 2014 Share Posted August 19, 2014 I've been following along with the book exercises in chapter 14, matches.php, and hit a snag when I used multiple email addresses as in example A page 450. print_r shows an array with the valid email matches except for the last one entered. When all the email addresses are valid, the last one is missing in the array. If the last entry is an invalid address, all the ones above it that are valid show up. To get all the valid ones to show, I have to put an entry in the last line. (ie trout or an invalid address) I checked the script with the book and can't find the source of the problem. Thanks for your help... Link to comment Share on other sites More sharing options...
HartleySan Posted August 19, 2014 Share Posted August 19, 2014 Hello and welcome to the forums. Please post the relevant code. Thanks. Link to comment Share on other sites More sharing options...
muhjum Posted August 19, 2014 Author Share Posted August 19, 2014 After some experimentation, I realized that removing the ? from '\r?' at the end of the expression to be tested means the last email in the tested list won't be read. I tried the postal code pcre: /^(\d{5})(-\d{4})?\r$/m which when showing the array in matches.php omited the last valid zip code line. Solved by adding ? after the \r : /^(\d{5})(-\d{4})?\r?$/m Link to comment Share on other sites More sharing options...
HartleySan Posted August 20, 2014 Share Posted August 20, 2014 Very good. Thanks for sharing. Link to comment Share on other sites More sharing options...
Recommended Posts