Laravel preg_match(): No ending delimiter '/' found
Since your regex has a pipe in it, you have to use an array:
public static $rules_save = [
'class_subjects' => ['required', 'regex:/[0-9]([0-9]|-(?!-))+/'],
];
From the docs:
When using the
regex
pattern, it may be necessary to specify rules in an array instead of using pipe delimiters, especially if the regular expression contains a pipe character.
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,}$/');
preg_match(): No ending delimiter '/' found Laravel
In Laravel you have ip validation rule so you can use:
return [
'segmentwan' => 'ip',
'segmentlan' => 'ip',
];
Also to be honest when I'm looking at your code I don't see the error. Are you sure error is with those 2 regexes?
Laravel time 24h format regex error (No ending delimiter)
Your rule is well done BUT you need to know, specify validation rules with regex separated by pipeline can lead to undesired behavior.
The proper way to define a validation rule should be:
'title' => 'required|max:100|regex:/^(?=.*[a-zA-Z]).+$/',
'start_time' => ['date_format:H:i','regex:/^((([01]?[0-9]|2[0-3]):[0-5][0-9])?)$/'],
You can read on the official docs:
regex:pattern
The field under validation must match the given regular expression.
Note: When using the regex pattern, it may be necessary to specify rules in an array instead of using pipe delimiters, especially if the regular expression contains a pipe character.
https://laravel.com/docs/5.6/validation#rule-regex
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
Related Topics
PHP Hierarchical Array - Parents and Childs
Remove All the Line Breaks from the HTML Source
Fix Malformed Xml in PHP Before Processing Using Domdocument Functions
How to Create Codeigniter Batch Insert Array
Create a Dynamic MySQL Query Using PHP Variables
Can PHP Namespaces Contain Variables
How to Set the Env Variable for PHP
Executing a Shell Script from a PHP Script
Post and Get at the Same Time in PHP
Retrieve All Hashtags from a Tweet in a PHP Function
Regex Pattern to Get the Youtube Video Id from Any Youtube Url
What Is the Most Efficient Way to Count All the Occurrences of a Specific Character in a PHP String
Parse Xml Namespaces with PHP Simplexml
How to Find the Date of a Day of the Week from a Date Using PHP