Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

Everything posted by hipromark

  1. Ok, let me try this way. Could you give me a pattern with preg match that match alphabetic characters, the numbers 1,2 and 3, and '%' ? I just need a pattern that is correctly written to use it as a model. Maybe this way I will find what I am doing wrong.
  2. This is an example that I saw in php.net, there they say this pattern finds: 0, 1, alfabetic characters, or %, but it doesn't do that in my script, is it because I have to install something on PHP or what is happening? Here is the page from where I take the example (Is in spanish but may be it has a mirror page in english): http://tr2.php.net/manual/es/regexp.reference.character-classes.php
  3. Hello, I am still having trouble with regular expressions. I made this script: <?php if (isset($_POST['submit'])) { $pattern = '#^[01[:alpha:]%]$#'; $string = $_POST['name']; if(!preg_match($pattern, $string)) { echo 'please use valid characters'; } else { echo 'Name format is correct'; } } Ok so when I run this script, even if I use alphabetic caracters, 1, 2, or % the message I receive is "please use valid characters", so the pattern is not recognized by PHP What am I doing wrong? Can anybody tell me?
  4. Ok I looked at PHP manual and now I see the problem was on the delimiter, I used # and it work perfectly. But regular expressions themselves are the same in POSIX and in PCRE, at least most of them am I right?
  5. Ok. Now I did this: $pattern = '^[[:alpha:]\.\' \-]{4,}$'; $string = $_POST['nombre']; if(!preg_match($pattern, $string)) { echo '<p>please enter a valid name</p>'; } else { echo 'Your name is ok'; } ?> And I get this error message: Warning: preg_match() [function.preg-match]: No ending delimiter '^'
  6. Thanks for your help, but how can I use preg_match_all in the same way as eregi and ereg are used in script 10.7. I need to do somethimng like: if (!eregi ('^[[:alpha:]\.\' \-]{4,}$', stripslashes(trim($_POST['name'])))) { $problem = TRUE; $message .= '<p>Please enter a valid name.</p>'; If I use preg_match_all I have to specify $matches, i don´t know how to handle $matches!
  7. Hello, It´s Me again. I am using regular expressions (Chapter 10, script 10.7) but the script doesn´t work, it seems it don´t recognizes them. I looked at PHP manual and it says eregi and ereg are obsolete. Is it true? what can I use instead?
  8. Nevermind, problem solved, I used the wrong scripts. Sorry! Great book Larry!
  9. Hello, I have made the two first scripts of chapter 9 (9.1 and 9.2) according to the book and I did the changes suggested for Internet explorer, but when I login the system sends me to the index page. I also used Larry´s scripts and still have the same result. Please help me with these!
  • Create New...