- 发布:2020-11-19 20:08
- 更新:2020-11-23 16:25
- 阅读:836
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: MacOS Mojave 10.15.7
HBuilderX类型: 正式
HBuilderX版本号: 2.9.8
手机系统: 全部
手机厂商: 苹果
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
测试过的手机:
示例代码:
let RexStr1 = new RegExp("(?<=<)[^<>]+(?=>)","g");
// let RexStr1 = /(?<=<)[^<>]+(?=>)/g;
this.strList = str.match(RexStr1)
let RexStr1 = new RegExp("(?<=<)[^<>]+(?=>)","g");
// let RexStr1 = /(?<=<)[^<>]+(?=>)/g;
this.strList = str.match(RexStr1)
操作步骤:
onLoad
onLoad
预期结果:
希望可以解决
希望可以解决
实际结果:
可以正常运行不报错即可.
拿到 strList 不是 null.
可以正常运行不报错即可.
拿到 strList 不是 null.
bug描述:
我使用了一个正则:
let RexStr1 = new RegExp("(?<=<)[^<>]+(?=>)","g");
// let RexStr1 = /(?<=<)[^<>]+(?=>)/g;
this.strList = str.match(RexStr1)
在 H5 是可以正常运行的,但是在 App 端似乎不认这个正则。
报错信息如下:
[Vue warn]: Error in onLoad hook: "SyntaxError: Invalid regular expression: /(?<=<)[^<>]+(?=>)/: Invalid group"
found in
---> <Root>
19:59:43.326 [system]SyntaxError: Invalid regular expression: /(?<=<)[^<>]+(?=>)/: Invalid group
at new RegExp (<anonymous>)
at VueComponent.strReplace (eval at ./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!../../../../../../Users/alonengineer/Downloads/Mad Libs/pages/index/index.vue?vue&type=script&lang=js& (http://localhost:8081/pages-index-index.64af72f5fe6e34c107b9.hot-update.js:11:1), <anonymous>:61:21)
at VueComponent.onLoad (eval at ./node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!../../../../../../Users/alonengineer/Downloads/Mad Libs/pages/index/index.vue?vue&type=script&lang=js& (http://localhost:8081/pages-index-index.64af72f5fe6e34c107b9.hot-update.js:11:1), <anonymous>:29:10)
at invokeWithErrorHandling (http://localhost:8081/static/js/chunk-vendors.js:5210:26)
at VueComponent.push../node_modules/@dcloudio/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js.Vue.__call_hook (http://localhost:8081/static/js/chunk-vendors.js:11952:17)
at r (http://localhost:8081/static/js/chunk-vendors.js:98:385335)
at a (http://localhost:8081/static/js/chunk-vendors.js:98:385977)
at VueComponent.created (http://localhost:8081/static/js/chunk-vendors.js:98:16884)
at invokeWithErrorHandling (http://localhost:8081/static/js/chunk-vendors.js:5210:57)
at callHook (http://localhost:8081/static/js/chunk-vendors.js:7616:7)
1 个回复
DCloud_UNI_LXH
在有些环境下,不支持正则的这种写法 (?<=...)