• <bdo id='NgWv6'></bdo><ul id='NgWv6'></ul>
      <tfoot id='NgWv6'></tfoot>
    1. <i id='NgWv6'><tr id='NgWv6'><dt id='NgWv6'><q id='NgWv6'><span id='NgWv6'><b id='NgWv6'><form id='NgWv6'><ins id='NgWv6'></ins><ul id='NgWv6'></ul><sub id='NgWv6'></sub></form><legend id='NgWv6'></legend><bdo id='NgWv6'><pre id='NgWv6'><center id='NgWv6'></center></pre></bdo></b><th id='NgWv6'></th></span></q></dt></tr></i><div id='NgWv6'><tfoot id='NgWv6'></tfoot><dl id='NgWv6'><fieldset id='NgWv6'></fieldset></dl></div>
      <legend id='NgWv6'><style id='NgWv6'><dir id='NgWv6'><q id='NgWv6'></q></dir></style></legend>

      <small id='NgWv6'></small><noframes id='NgWv6'>

        Laravel preg_match():没有找到结束分隔符'/'

        Laravel preg_match(): No ending delimiter #39;/#39; found(Laravel preg_match():没有找到结束分隔符/)

            • <bdo id='puooM'></bdo><ul id='puooM'></ul>
                <tfoot id='puooM'></tfoot>

                  <small id='puooM'></small><noframes id='puooM'>

                  <legend id='puooM'><style id='puooM'><dir id='puooM'><q id='puooM'></q></dir></style></legend>
                    <tbody id='puooM'></tbody>
                  <i id='puooM'><tr id='puooM'><dt id='puooM'><q id='puooM'><span id='puooM'><b id='puooM'><form id='puooM'><ins id='puooM'></ins><ul id='puooM'></ul><sub id='puooM'></sub></form><legend id='puooM'></legend><bdo id='puooM'><pre id='puooM'><center id='puooM'></center></pre></bdo></b><th id='puooM'></th></span></q></dt></tr></i><div id='puooM'><tfoot id='puooM'></tfoot><dl id='puooM'><fieldset id='puooM'></fieldset></dl></div>
                  本文介绍了Laravel preg_match():没有找到结束分隔符'/'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发 Laravel 4.2.我尝试使用 Validator 使用正则表达式验证名称字段,这是我的规则如下:

                  Im working on Laravel 4.2. Im trying to use Validator to validate a name field with regex, here is my rule below:

                   public static $rules_save = [
                  
                          'class_subjects' => 'required|regex:/[0-9]([0-9]|-(?!-))+/'
                      ];
                  

                  但是,一旦我调用要验证的规则,就会引发错误,请参见下文:

                  But as soon as I call the rule to be validated an error is thrown, see below:

                  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]|-(?!-))+/'],
                  ];
                  

                  来自文档:

                  使用 regex 模式时,可能需要在数组中指定规则而不是使用管道分隔符,尤其是当正则表达式包含管道字符时.

                  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.

                  这篇关于Laravel preg_match():没有找到结束分隔符'/'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Laravel 4 - Connect to other database(Laravel 4 - 连接到其他数据库)
                  Call external API function from controller, LARAVEL 4(从控制器调用外部 API 函数,LARAVEL 4)
                  Empty string instead of null values Eloquent(空字符串而不是空值 Eloquent)
                  quot;laravel.logquot; could not be opened: failed to open stream(“laravel.log无法打开:无法打开流)
                  Displaying the Error Messages in Laravel after being Redirected from controller(从控制器重定向后在 Laravel 中显示错误消息)
                  Laravel Creating Dynamic Routes to controllers from Mysql database(Laravel 从 Mysql 数据库创建到控制器的动态路由)

                          <tbody id='E3jVB'></tbody>
                        <tfoot id='E3jVB'></tfoot>

                        <small id='E3jVB'></small><noframes id='E3jVB'>

                      1. <i id='E3jVB'><tr id='E3jVB'><dt id='E3jVB'><q id='E3jVB'><span id='E3jVB'><b id='E3jVB'><form id='E3jVB'><ins id='E3jVB'></ins><ul id='E3jVB'></ul><sub id='E3jVB'></sub></form><legend id='E3jVB'></legend><bdo id='E3jVB'><pre id='E3jVB'><center id='E3jVB'></center></pre></bdo></b><th id='E3jVB'></th></span></q></dt></tr></i><div id='E3jVB'><tfoot id='E3jVB'></tfoot><dl id='E3jVB'><fieldset id='E3jVB'></fieldset></dl></div>
                        <legend id='E3jVB'><style id='E3jVB'><dir id='E3jVB'><q id='E3jVB'></q></dir></style></legend>

                          <bdo id='E3jVB'></bdo><ul id='E3jVB'></ul>