当前位置:网站首页>写一个正则
写一个正则
2022-04-23 05:54:00 【迷失的骆驼】
需求:
字符串:股票代码:002354,股票简称:*ST天娱,编号:2020--119,债券代码:112496,债券简称:17天神01,大连天神娱乐股份有限公司,关于“17天神01"摘牌的公告,
需要的字符串:大连天神娱乐股份有限公司
const str = '股票代码:002354,股票简称:*ST天娱,编号:2020--119,债券代码:112496,债券简称:17天神01,大连天神娱乐股份有限公司,关于“17天神01"摘牌的公告,'
const info = str.split(/(?<=[:][^,]+),(?=[^,]+[:])/g).map(m=>({ key:m.split(':')[0],value:m.split(':')[1] }))
const compJJ = info.find(m=>m.key ==='债券简称')
const compName = compJJ ? compJJ.value.split(',')[1] : ''
console.log(info,compJJ,compName)
// compName 为得到的公司名
版权声明
本文为[迷失的骆驼]所创,转载请带上原文链接,感谢
https://blog.csdn.net/xufang461010923/article/details/111175127
边栏推荐
猜你喜欢
[UDS unified diagnostic service] II. Network layer protocol (2) - data transmission rules (single frame and multi frame)
2020 Jiangsu Collegiate Programming Contest-A.Array
Principle and characteristic analysis of triode
Shell脚本 &&和||的使用
el-table添加序号
cv_bridge 与opencv 版本不匹配的解决
Opencv uses genericindex for KNN search
浮点数双精度,单精度以及半精度知识总结
C [document operation] PDF files and pictures are converted to each other
VHDL 有限状态机(FSM) 代码示例
随机推荐
[UDS unified diagnosis service] i. diagnosis overview (1) - diagnosis overview
谈谈v-if显示隐藏问题
cv_bridge 与opencv 版本不匹配的解决
导入文件时候 new FormData()
如何读文献
查漏补缺(四)
C语言 #和##的使用
Detailed explanation and application principle of token
卷积神经网络实现CIFAR100数据集分类
Round up a little detail of the round
useCenterHook
Makefile基础、常用函数及通用Makefile
Krypton binary
Qt 添加QSerialPort类 实现串口操作
特效案例收集:鼠标星球小尾巴
Modify registry values
Vs can be compiled, but there will be a red underline to indicate the problem of undefined identifiers
cuda工程更换环境(电脑)后遇到的一系列编译问题
2020 Jiangsu Collegiate Programming Contest-A.Array
2022LDU寒假训练-程序补丁