javascript - 从 json 响应获取数据需要什么正则表达式或功能

标签 javascript jquery regex

$.ajax({
    url: link,   //https://www.linkedin.com/company/666511/
    type: 'GET',
    success: function (data) {
console.log(data)

//response comes in 2000 lines  
here is the sample short response

["Web Development","Professional Training","Apprenticeship","Nonprofit"]
,
"companyPageUrl":"http://www.thedifferenceengine.io"

//i only want this link to return
http://www.thedifferenceengine.io
}
});

i dont understant what regex or jquery require or how i remove this &quote and get companypageurl

最佳答案

您可以使用正则表达式

/http:[^;]+/

let str = '["Web Development","Professional Training","Apprenticeship","Nonprofit"],"companyPageUrl":"http://www.thedifferenceengine.io"'

console.log(str.match(/http:[^;]+/));

关于javascript - 从 json 响应获取数据需要什么正则表达式或功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46584462/

相关文章:

javascript - ReactJS需要从外部类组件调用函数

javascript - 如何将所有输入的值更改为小写或大写?在 JavaScript/jQuery 中

jQuery Accordion HTML 链接问题

r - 将一列分成多个变量,在 R 中具有唯一的列名

javascript - 使用正则表达式替换字符串末尾的换行符

JavaScript 拆分方法删除前 2 个部分

javascript - 访问对象属性时如何避免 eval?

javascript - 从元素的兄弟元素中选择一个元素

javascript - 在 javascript 中执行没有 while 循环条件的组提取?

javascript - 使用 highcharts 悬停系列时增加不同的标记大小