var reg = "/^1[34578]\d{9}$/"; //错误格式,这是一个字符串

var reg2 = /^1[34578]\d{9}$/; //正确格式

reg .test($scope.message.plateNumber); //这时会报错 reg.test is not a function

解决办法: 

new RegExp(reg); //将字符串格式转化为正则表达式

正则表达式test报错 is not a function的更多相关文章

  1. 运行gulp项目报错:AssertionError: Task function must be specified。

    一.问题描述: gulp项目在本地windows 10机器上跑没有任何问题,但是放在centos 7虚拟机上跑报错:AssertionError: Task function must be spec ...

  2. 微信小游戏5.2.2 在子项目中使用EUI制作排行榜报错 wx.getFileSystemManager not function

    本来想子项目(开放数据域)想使用EUI来制作排行榜. 原5.1.11的时候是ok的.在5.2.2中,使用assetsmananger而不是res,则会报错wx.getFileSystemManager ...

  3. php5.6.30环境报错Call to undefined function ImageCreate() 编译安装 gd库

    php5..30环境报错Call to undefined function ImageCreate() 编译安装 gd库 发现php5..30没有加载gd库 [root@cn_vs_web04:/u ...

  4. vue项目报错Missing space before function parentheses的问题

    问题描述为——函数括号前缺少空格 导致原因主要是,使用eslint时,严格模式下,会报错Missing space before function parentheses的问题,意思是在方法名和刮号之 ...

  5. PHP加密3DES报错 Call to undefined function: mcrypt_module_open() 的解决方法

    我也是PHP新手,通过w3cschool了解了一下php基本原理之后就开写了.但仍是菜鸟. 先不管3DES加密的方法对不对,方法都是网上的,在运行的时候报了个错,把小弟整死了.找来找去终于自己摸出了方 ...

  6. PHP在 win7 64位 旗舰版 报错 Call to undefined function curl_init()

    代码在ubuntu下无缝运行OK 转到我的win7 64位 期间 学习机上 报错: Call to undefined function curl_init() 因为用到curl 远程抓取数据. 所以 ...

  7. Laravel5.5/6 报错call to undefined function openssl cipher iv length()

    在安装laravel5.5后, 访问显示报错. call to undefined function openssl cipher iv length() 经查为php7.1的OpenSSL扩展加载失 ...

  8. Flask - 访问返回字典的接口报错:The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a dict.

    背景 有一个 Flask 项目,然后有一个路由返回的是 dict 通过浏览器访问,结果报错 关键报错信息 TypeError: 'dict' object is not callable The vi ...

  9. php报错 ----> Call to undefined function imagecreatetruecolor()

    刚才在写验证码的时候,发现报错,然后排查分析了一下,原来是所用的php版本(PHP/5.3.13)没有开启此扩展功能. 进入php.ini 找到extension=php_gd2.dll ,将其前面的 ...

随机推荐

  1. POJ 2892 Tunnel Warfare(树状数组+二分)

    题目链接 二分求上界和下界,树状数组.注意特殊情况. #include <cstring> #include <cstdio> #include <string> ...

  2. Gym - 100341C FFT优化DP

    题目链接:传送门 题解: 设定dp[i][j]在深度为i下,使用j个节点的方案数 显然的转移方程组就是 dp[h][n] = dp[h-1][i] * dp[h-1][n-i-1] + 2*dp[h- ...

  3. ZOJ 3874 Permutation Graph 分治NTT

    Permutation Graph Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward has a permutation {a1, a2 ...

  4. 集群环境搭建-SSH免密码登陆(二)

    1.打开sshd配置 命令: vi /etc/ssh/sshd_config 找到以下内容,并去掉注释符”#“ RSAAuthentication yes PubkeyAuthentication y ...

  5. 20170223 遇到自建表里面相同key值数据不唯一

     我怎么发现这个表里 key值相同数据不唯一, 这两条看起来是完全相同的, 其实排序不能能合并已经说明问题.

  6. 用secureCRT ssh登陆不显示用户名和路径解决方案 分类: 软件工具学习 2015-03-18 16:52 36人阅读 评论(0) 收藏

    方法1         每次开始的时候输入 bash 虽然只能保存一次,但是简便. 方法2 用       vi ~/.bash_profile   编辑这个文件,  有时会提示这个文件不存在,直 ...

  7. 修改u-boot的开机logo及显示过程【转】

    本文转载自;http://blog.csdn.net/voice_shen/article/details/6789424 [ u-boot: Git://git.denx.de/u-boot.git ...

  8. open调用过程

    1. 首先传到vfs的do_sys_open,在open.c中. long do_sys_open(int dfd, const char __user *filename, int flags, u ...

  9. UILabel 常见问题总结

    写在前面:笔者在iOS软件开发中发现UILabel控件有些问题反复出现,所以在这里做点总结,方便自己查阅,也能给大家提供相关问题的解决方案. 一:当label里的内容显示满了的时候,能够自动将字体变小 ...

  10. 一些优秀的iOS第三方库

    文章目录 Kits ProgressHUD 加载与刷新 图像 引导页 Views Others Kits RegexKitRegexKit是一个正则表达式工具类. JSONKitJSONKit是一个比 ...