2

Possible Duplicate:
php regular expressions No ending delimiter ‘^’ found in

The code is as follows:

if(preg_match($exp, $value)){
   return "";           
}
  • the value of $exp is: ^[0-9]*$
  • the value of $value is: 7

and the output gives :

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /...

Community
  • 1
  • 1
Lawrence DeSouza
  • 984
  • 5
  • 16
  • 34
  • Which was easy to find by searching your exact question title on the site. Please do that as well before actually asking the question. See http://stackoverflow.com/questions/11334591/why-does-this-regular-expression-result-in-preg-match-no-ending-delimite and the many others, your error is quite common. – hakre Nov 16 '12 at 08:48

1 Answers1

3

$exp should be something like /^[0-9]*$/ for it to work the way you intended. It is assuming ^ is your regex delimiter, because it is the first character - you'd want your first char to be something else. See preg_match manual entry for details.

eis
  • 51,991
  • 13
  • 150
  • 199