所以,我的模型中有以下规则:
public static $rules = array( 'name' => 'required|alpha_dash|unique:subsidiaries','internal_number' => 'required|alpha_dash|unique:subsidiaries','expedition_rate' => array('required','regex:/^[0-9]{1,3}(\.?)[0-9]{1,2}$/'),'hundred_kg_rate' => array('regex:/^[0-9]{1,5}(\.?)[0-9]{1,'handling' => array('regex:/^[0-9]{1,'insurance' => 'required|numeric',);
但是,出于某种原因,当正则表达式应用于html中的模式属性标记时…它会中断!@H_403_4@
结果:@H_403_4@
<input required="true" pattern="^[0-9]{" class="form-control" ....> _________ \ => This right here should be ^[0-9]{1,2}$
尝试使用这样的.
array( 'field' => 'regex:[a-z]' );
希望这会有所帮助.@H_403_4@