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. swift的String处理

    import UIKit import CoreText class ViewController: UIViewController { override func viewDidLoad() { ...

  2. android 提示

    1.Toast: Toast toast=new Toast(context); Toast.makeText(context, text, duration);//返回值为Toast toast.s ...

  3. IE6span 高度问题

    IE6盒子的最小高度为20px,所以设置低于20px大小时,加上_overflow:hidden;

  4. Codeforces Beta Round #25 (Div. 2 Only)E. Test

    E. Test time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  5. 如何使用git 生成patch 和打入patch【转】

    本文转载自:http://blog.csdn.net/liuhaomatou/article/details/54410361 平时我们在使用git 管理项目的时候,会遇到这样一种情况,那就是客户使用 ...

  6. POJ1797 Heavy Transportation —— 最短路变形

    题目链接:http://poj.org/problem?id=1797 Heavy Transportation Time Limit: 3000MS   Memory Limit: 30000K T ...

  7. 织梦CMS被挂马特征汇总

    一.织梦CMS被挂马特征汇总 2013织梦CMS被挂马特征汇总.最近很多朋友反应后台多了几个系统管理员用户:service.spider等,而且自己之前的管理员用户登陆时候会提示用户名不存在.还有朋友 ...

  8. 小米2在Eclipse 调试,要注意下列步骤。(转)

    小米2在Eclipse 调试,要注意下列步骤.1.连接线,打开设置:USB线连接小米2,在设置-->开发者选项->USB 调是打开.如果这一步,就业在Eclipse中真机调试,下面的步骤不 ...

  9. 使用gcc找出头文件的路径

    参考 http://stackoverflow.com/questions/13079650/how-can-i-find-the-header-files-of-the-c-programming- ...

  10. Unity5.6打包问题

    将unity切换到5.6版本后打Android包时,提示android sdk tools version低于compile version,于是更新了android-sdk(下载了Android-S ...