在bootstrap验证中用于srting模式的正则表达式 [英] Regular expression for srting pattern in bootstrap validation

查看:102
本文介绍了在bootstrap验证中用于srting模式的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我在创建正则表达式以验证PHP系统中的字段时遇到问题。我已经搜索了很多解决方案,但我找不到合适的解决方案。任何人都可以帮我创建一个符合以下格式的正则表达式。我尝试过以下编码,但在验证时,需要删除一个字符或空格。如果有人能帮助我解决这个问题,我将非常感激。谢谢。



格式:



(数字)| (英文字母)。



Ex:12 | Harindu



我尝试过:



Hi all

I'm having a problem in creating a regular expression to validate a field in my PHP system. I have searched for many solutions, but I haven't found a proper one. Can anyone help me to create a regular expression matches the following format. I have tried the below coding, but when validating, it requires to delete a character or whitespace. I would be much obliged if anyone could kindly help me to sort out this issue. Thank you.

Format:

(Numbers) | (English letters).

Ex : 12 | Harindu

What I have tried:

invoice_customer : { validators: {

        notEmpty : { message : 'Customer is required.'},

         regexp: {
             regexp: '\\s\\|\\s',
             message: 'Invalid Format'
         }


    }


},

推荐答案

请参阅 RegExr :学习,构建,和测试RegEx [ ^ ]。


这篇关于在bootstrap验证中用于srting模式的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆