PHP regular expressions: No ending delimiter '^' found in
PHP regex strings need delimiters. Try:
$numpattern="/^([0-9]+)$/";
Also, note that you have a lower case o, not a zero. In addition, if you're just validating, you don't need the capturing group, and can simplify the regex to /^\d+$/
.
Example: http://ideone.com/Ec3zh
See also: PHP - Delimiters
preg_match php error - No ending delimiter '^' found
$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.
preg_match(): No ending delimiter '/'
I think you are missing syntax here.You can use below pattern for your regular expression.
array('phone' => 'required', 'required|regex:/^\+?[^a-zA-Z]{5,}$/');
No ending delimiter '/' found error
The error is very clear really, you didn't include the trailing /
:
preg_match('/<div id="resultStats">About \(.*?)\ /',$v,$s);
I honestly doubt your escape characters are well placed though. Maybe you meant \)
?
PHP RegEx - no ending delimiter?
You need delimiters around your regex, usually /
s:
if (preg_match("/^[A-Z0-9\-]{5}$/", $_GET['serial']) === false)
^---------------^
But any non-alphanumeric character is valid (even paired brackets), although it makes most sense to use ~
, #
or other symbols that aren't regex metacharacters or often used in text searches:
if (preg_match("#^[A-Z0-9\-]{5}$#", $_GET['serial']) === false)
In your case, as pointed out by Andy Lester, the regex engine thinks that ^
was supposed to be the delimiter (possible, but you then lose the "start of string" anchor for use in your regex and have to use \A
instead):
if (preg_match("^\A[A-Z0-9\-]{5}$^", $_GET['serial']) === false)
Related Topics
Forcing to Download a File Using PHP
How to Use Store and Use Session Variables Across Pages
Sort Array of Objects by One Property
How to Retrieve Images from MySQL Database and Display in an HTML Tag
Simplest Way to Detect a Mobile Device in PHP
Sending Email With Gmail Smtp With Codeigniter Email Library
How to Log Errors and Warnings into a File
What's Wrong With Using $_Request[]
File_Get_Contents(): Ssl Operation Failed With Code 1, Failed to Enable Crypto
How to Get Parameters from a Url String
PHP Syntax For Dereferencing Function Result
How to Run PHP from Windows Command Line in Wampserver
Compiling an Ast Back to Source Code
Only Variables Should Be Passed by Reference
I Have 2 Dates in PHP, How to Run a Foreach Loop to Go Through All of Those Days