当前位置:网站首页>微信小程序正则表达式提取链接
微信小程序正则表达式提取链接
2022-07-05 19:56:00 【德宏大魔王】
原因:
最近在开发这一款小程序,用于去水印的,接口大家也知道都泛滥了,用小程序对接,毫无压力,既能获得一点广告收益,也可以当作工具给自己用,输入/粘贴链接后,即可提取出无水印视频,然后保存在手机上
问题
通过复制视频软件的链接会得到类似如下的内容(可见并不是纯文字的),已经打码
1.56 SlC:/ 90年****妆容教学 # 古风 # ****教学 # 古典妆容 https://v.*5Q7/ 复制此链接,打开搜索,直接观看视频!
解决办法
通过正则表达式:
1、新建方法get_url
get_url:function(string) {
let that=this;
var reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g; if (reg.test(string)) {
return string.match(reg)[0];
} else {
return "";
}
},
2、调用即可
var new_copy=that.get_url(that.data.copy);
console.log(new_copy);
效果:
完整处理后:
好了,就到这里了
边栏推荐
- Worthy of being a boss, byte Daniel spent eight months on another masterpiece
- Zhongang Mining: analysis of the current market supply situation of the global fluorite industry in 2022
- 常用运算符与运算符优先级
- okcc呼叫中心有什么作用
- leetcode刷题:二叉树18(最大二叉树)
- How to safely and quickly migrate from CentOS to openeuler
- redis集群模拟消息队列
- DP:树DP
- XaaS 陷阱:万物皆服务(可能)并不是IT真正需要的东西
- third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctl
猜你喜欢
通过POI追加数据到excel中小案例
[OBS] qstring's UTF-8 Chinese conversion to blog printing UTF-8 char*
Parler de threadlocal insecurerandom
Complete interview questions for interviewers and senior Android engineers in front-line Internet enterprises
C application interface development foundation - form control (5) - grouping control
leetcode刷题:二叉树10(完全二叉树的节点个数)
leetcode刷题:二叉树15(找树左下角的值)
618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
成功入职百度月薪35K,2022Android开发面试解答
UWB ultra wideband positioning technology, real-time centimeter level high-precision positioning application, ultra wideband transmission technology
随机推荐
ACM getting started Day1
c——顺序结构
618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
DP:树DP
CADD课程学习(7)-- 模拟靶点和小分子相互作用 (半柔性对接 AutoDock)
图嵌入Graph embedding学习笔记
How to apply smart contracts more wisely in 2022?
Common operators and operator priority
建立自己的网站(16)
Summer Challenge harmonyos - realize message notification function
Debezium series: modify the source code to support drop foreign key if exists FK
What is the core value of testing?
Float.floatToRawIntBits的返回值具体意思,将float转为byte数组
建议收藏,我的腾讯Android面试经历分享
openh264解码数据流向分析
Multi branch structure
完爆面试官,一线互联网企业高级Android工程师面试题大全
股票开户哪里好?网上客户经理开户安全吗
How about testing outsourcing companies?
What do software test engineers do? How about the prospect of treatment?