当前位置:网站首页>微信小程序正则表达式提取链接
微信小程序正则表达式提取链接
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);
效果:
完整处理后:
好了,就到这里了
边栏推荐
- leetcode刷题:二叉树15(找树左下角的值)
- leetcode刷题:二叉树14(左叶子之和)
- Complete interview questions for interviewers and senior Android engineers in front-line Internet enterprises
- 再忙不能忘安全
- leetcode刷题:二叉树10(完全二叉树的节点个数)
- gst-launch的-v参数
- Reptile exercises (II)
- C application interface development foundation - form control (5) - grouping control
- ffplay文档[通俗易懂]
- Go language | 03 array, pointer, slice usage
猜你喜欢

众昂矿业:2022年全球萤石行业市场供给现状分析
Successful entry into Baidu, 35K monthly salary, 2022 Android development interview answer

Elk distributed log analysis system deployment (Huawei cloud)

Postman core function analysis - parameterization and test report
![[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform](/img/64/08faef0fccec93337f0716ac57dd8e.jpg)
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform

【无标题】

Worthy of being a boss, byte Daniel spent eight months on another masterpiece

redis集群模拟消息队列

【硬核干货】数据分析哪家强?选Pandas还是选SQL

Bitcoinwin (BCW)受邀参加Hanoi Traders Fair 2022
随机推荐
期货如何网上开户?安不安全?
Redis cluster simulated message queue
c语言oj得pe,ACM入门之OJ~
常用运算符与运算符优先级
Four methods of random number generation | random | math | threadlocalrandom | securityrandom
acm入门day1
Let's talk about threadlocalinsecurerandom
Multi branch structure
Debezium series: parsing the default value character set
淺淺的談一下ThreadLocalInsecureRandom
C application interface development foundation - form control (6) - menu bar, toolbar and status bar controls
Tasks in GStreamer
Xaas trap: all things serve (possible) is not what it really needs
c——顺序结构
软件测试工程师是做什么的?待遇前景怎么样?
C#应用程序界面开发基础——窗体控制(5)——分组类控件
中金财富在网上开户安全吗?
力扣 729. 我的日程安排表 I
Flume series: interceptor filtering data
ICTCLAS用的字Lucene4.9捆绑
