10
回答
出个文本算法题目,你会怎么截取下面的字符串,获取到名字?
科大讯飞通用文字识别100000次/天免费使用。立即申请   

出个文本算法题目,你会怎么截取下面的字符串,获取到名字?

沈林海这个名字

:沈林海电话:<span class="hl"></span> 行业代码:6341,注册类型:173,营业状况:2,隶属关系:90,机构类型:10 热诚欢迎大家来电咨询!  锻炼机会多 交通费 不定期FB活动 工龄工资 工作...</p><div class="result-footer"><cite>www.1024sj.com/com/qiye.aspx?id=9103299 - 2016-06-12</cite>- <a class="snapshot" id="snapshotLink$pos" href="cache?q=13951108999&url=http%3A%2F%2Fwww.1024sj.com%2Fcom%2Fqiye.aspx%3Fid%3D9103299&" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'snapshot.$pos', 'PAGE_CLICK','','','','normal');">快照</a></div></div></div></li><li class="res-list"><div class="rnw default"><div class="tl"><h3><a href="http://www.707070.cn/qiye/card-8910915.html" id="hitURL$pos"onmousedown="javascript:ct(this, '13951108999', '${pos}.1', 'OPEN_HIT', '', '', '','normal');"target="_blank"><span id="title$pos">苏州日联贸易有限公司的网络名片,
:沈林海--企领网</span></a></h3></div><div id="summary$pos"><p>
:沈林海电话:<span class="hl">13951108999</span> 行业代码:6341,注册类型:173,营业状况:2,隶属关系:90,机构类型:10 热诚欢迎大家来电咨询! 主营项目:办公用品销售 注册资本或投资:未填写 职...</p><div class="result-footer"><cite>www.707070.cn/qiye/card-8910915.html - 2015-11-14</cite>- <a class="snapshot" id="snapshotLink$pos" href="cache?q=13951108999&url=http%3A%2F%2Fwww.707070.cn%2Fqiye%2Fcard-8910915.html&" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'snapshot.$pos', 'PAGE_CLICK','','','','normal');">快照</a></div></div></div></li><li class="res-list"><div class="rnw default"><div class="tl"><h3><a href="http://tw.chahaoba.com/index.php?oldid=777144&title=1395110" id="hitURL$pos"onmousedown="javascript:ct(this, '13951108999', '${pos}.1', 'OPEN_HIT', '', '', '','normal');"target="_blank"><span id="title$pos">1395110 电话区号查询|手机号码归属- 查号吧www.ChaHaoBa.com</span></a></h3></div><div id="summary$pos"><p>13951108:13951108000-<span class="hl">13951108999</span> 13951109:13951109000-13951109999 安全提示:因为存在用电话诈骗、短信陷阱、引诱回拨国际长途、引诱回拨收费声讯台等陷阱,遇...</p><div class="result-footer"><cite>tw.chahaoba.com/index.php?oldid=777144&title=1395110 - 2016-06-02</cite>- <a class="snapshot" id="snapshotLink$pos" href="cache?q=13951108999&url=http%3A%2F%2Ftw.chahaoba.com%2Findex.php%3Foldid%3D777144%26title%3D1395110&" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'snapshot.$pos', 'PAGE_CLICK','','','','normal');">快照</a></div></div></div></li><li class="res-list"><div class="rnw default"><div class="tl"><h3><a href="http://www.nmrxw.com/a/mobile/suzhou_1395110.html" id="hitURL$pos"onmousedown="javascript:ct(this, '13951108999', '${pos}.1', 'OPEN_HIT', '', '', '','normal');"target="_blank"><span id="title$pos">江苏省苏州市1395110号段手机号大全-农民热线网</span></a></h3></div><div id="summary$pos"><p><span class="hl">13951108999</span> 13951108998 13951108997 13951108996 13951108995 13951108994 13951108993 13951108992 13951108991 13951108990 13951108989 1395110898...</p><div class="result-footer"><cite>www.nmrxw.com/a/mobile/suzhou_1395110.html - 2015-12-15</cite>- <a class="snapshot" id="snapshotLink$pos" href="cache?q=13951108999&url=http%3A%2F%2Fwww.nmrxw.com%2Fa%2Fmobile%2Fsuzhou_1395110.html&" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'snapshot.$pos', 'PAGE_CLICK','','','','normal');">快照</a></div></div></div></li></ol><script type="text/javascript">window.time.CT=(new Date()).getTime();</script><div class="c-relatedkeys "><table><caption>相关搜索:</caption><tbody><tr><td><a onmousedown="javascript:ct(this, '"{"query":"13951108999","result":[],"version":"c"}"', 'result.relatedQuery', 'RELATEDQUERY_CLICK','','','','normal');"href='search?q=%22%7B%22query%22%3A%2213951108999%22%2C%22result%22%3A%5B%5D%2C%22version%22%3A%22c%22%7D%22&start=0&ue=utf8&keyfrom=web.related&lq=13951108999&rqp=0'>"{"query":"13951108999","result":[],"version":"c"}"</a></td></tr></tbody></table></div></div></div><div class="c-leftnav"><div class="c-lnv" id="rstype"><ul><li><strong>网页结果</strong></li><li><a href="http://news.youdao.com/search?keyfrom=web.precom&q=13951108999">新闻</a></li><li><a href="http://video.youdao.com/search?keyfrom=web.precom&q=13951108999">视频</a></li><li><a href="http://image.youdao.com/search?keyfrom=web.precom&q=13951108999">图片</a></li></ul></div></div><div id="ext"><div id="splink"><p class="gray">赞助商链接</p><ul class="rz"><li><a class="black"href='http://sou114.58.com.cn/58show6.php?keyfrom=youdao&key5=13951108999'target=_blank onmousedown="javascript:ct(this, '13951108999', '58show6.right', 'CNNIC_CLICK');">精选热门<span class="hl">13951108999</span>,点此查看!</a></li><li><a class="black"href='http://sou114.58.com.cn/58show.php?keyfrom=youdao&key5=13951108999'target=_blank onmousedown="javascript:ct(this, '13951108999', '58show.right', 'CNNIC_CLICK');">找最新<span class="hl">13951108999</span>,点此进入</a></li><li><a class="gray" href="http://a.youdao.com" target="_blank">在此展示您的推广信息</a></li></ul></div></div></div></div><div class="c-bsearch"><form onsubmit="tlSBT('T1')" method="get" action="/search" class="c-fm-w" ><span class="s-inpt-w" ><input type="text" class="s-inpt" autocomplete="off" name="q" id="" value="13951108999" /></span><span class="s-btn-w"><input type="submit" class="s-btn" value="搜 索"/></span><input type="hidden" name="lq" value="13951108999" /><input type="hidden" name="ue" value="utf8" /><input id="T1" type="hidden" name="T1" value="-1" /><input type="hidden" name="keyfrom" value="web.bottom" /><div class="sg-wrap" style="width:519px;display:none"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td valign="top"><ul class="sg-result-list"></ul></td><td class="sob-wrap" style="display:none;"></td></tr></table></div></form><div class="fblinks"><a href="http://survey2.163.com/html/npsofyoudaosearch1105/paper.html" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'survey', 'OPEN_HIT')">满意度调查</a>&nbsp;&nbsp;|&nbsp;<a href="http://feedback.youdao.com/quality_report.jsp?q=13951108999&prodtype=websearch&email=" onmousedown="javascript:ct(this, '13951108999', 'feedback', 'OPEN_HIT')">反馈意见</a></div></div><div id="c_footer"><a href="http://a.youdao.com/">企业推广</a><span class="c_fnl">|</span><a href="http://www.youdao.com/about">关于有道</a><span class="c_fnl">|</span><a href="http://i.youdao.com">官方博客</a><span class="c_fnl">|</span><a href="http://job.youdao.com">诚聘英才</a><p class="c_fcopyright">&copy;2016 网易公司 <a href="http://www.youdao.com/terms/privacy.html">隐私政策</a> <a href="http://www.youdao.com/terms/index.html">服务条款</a> 京ICP证080268号 京公网安备11010802020092号</p></div></div><div data-skin="http://shared.ydstatic.com/images/skins/default/skin-searchresult.png" id="custheme"> </div><div style="position:absolute;display:none;" class="preview-box" id="prv-window"><div class="preview-arrow" id="prv-arr"><em>◆</em><span>◆</span></div><div class="preview-box-cont"><a id="close_prv" href="javascript:void(0)" class="preview-close" title="关闭">×</a><div class="preview-top"><div  id="title_text"></div><p class="preview-serchwords">查找:<a href="javascript:void(0)"><span class="hl1" href="javascript:gotoNextKey(1)"title="寻找下一个“13951108999”">13951108999</span></a></p></div><div class="preview-detail" id="view_content"></div></div></div><script type="text/javascript">var ctImagesCache=[];function tlSBT(b){document.getElementById(b).value=""+(new Date).getTime()}function ct(h,b,g,d,j,c,f,k){var e=new Image();if(typeof(f)=="undefined"){f=""}else{if(f.length>0&&f[0]!="&"){f="&"+f}}if(typeof k=="undefined"){k=""}else{if(k.length>0&&k[0]!="&"){k="&testtype="+k}}e.src="http://www.youdao.com/ctlog?q="+b+"&url="+encodeURIComponent(h.href)+"&pos="+g+"&modifiers="+j+"&action="+d+"&hitSource="+c+f+k;ctImagesCache.push(e);return true}function seturl(e,d,f,h,i){e.href="http://"+f+".youdao.com/";i||(i="search?q=");if(window.RegExp&&window.encodeURIComponent){d=document.getElementById(d).value;if(d!=""){d=d.replace(/(link:)|(inlink:)|(^related:)/,"");e.href=e.href+i+encodeURIComponent(d)+"&keyfrom="+h;}}return true;}</script><script type="text/javascript"  src="http://shared.ydstatic.com/dao/search/outweb/js/yd.js?201311221"></script><script type="text/javascript"  src="http://shared.ydstatic.com/dao/search/outweb/js/suggest-new.js?201311221"></script><script type="text/javascript" src="scripts/tgl.js"></script><script type="text/javascript">window.time.T5 = (new Date()).getTime();(function (YD) {var transData = function (data) {var r = [], s = data.s, i = 0, l = s.length;for (; i < l; i++) {r.push({'c': s[i]});}return r;};var sug = YD.ui.suggest({source:"http://sug.so.360.cn/suggest/word?callback=YD.updateCall&encodein=utf-8&encodeout=utf-8&word=",menu: YD.cn("sg-wrap")[0], transData: transData}, "query");window.onload = function() {window.time.T6 = (new Date()).getTime();YD.buildScript("http://shared.ydstatic.com/dao/search/outweb/js/packed_tgl_new.js?201311221");};})(getNS());</script></body></html>


举报
bindao58
发帖于2年前 10回/579阅
共有10个答案 最后回答: 2年前
var txt = `
:沈林海电话:<span class="hl"></span> 行业代码:6341,注册类型:173,营业状况:2,隶属关系:90,机构类型:10 热诚欢迎大家来电咨询!  锻炼机会多 交通费 不定期FB活动 工龄工资 工作...</p><div class="result-footer"><cite>www.1024sj.com/com/qiye.aspx?id=9103299 - 2016-06-12</cite>- <a class="snapshot" id="snapshotLink\$pos" href="cache?q=13951108999&url=http%3A%2F%2Fwww.1024sj.com%2Fcom%2Fqiye.aspx%3Fid%3D9103299&" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'snapshot.\$pos', 'PAGE_CLICK','','','','normal');">快照</a></div></div></div></li><li class="res-list"><div class="rnw default"><div class="tl"><h3><a href="http://www.707070.cn/qiye/card-8910915.html" id="hitURL\$pos"onmousedown="javascript:ct(this, '13951108999', '\${pos}.1', 'OPEN_HIT', '', '', '','normal');"target="_blank"><span id="title\$pos">苏州日联贸易有限公司的网络名片,
:沈林海--企领网</span></a></h3></div><div id="summary\$pos"><p>
:沈林海电话:<span class="hl">13951108999</span> 行业代码:6341,注册类型:173,营业状况:2,隶属关系:90,机构类型:10 热诚欢迎大家来电咨询! 主营项目:办公用品销售 注册资本或投资:未填写 职...</p><div class="result-footer"><cite>www.707070.cn/qiye/card-8910915.html - 2015-11-14</cite>- <a class="snapshot" id="snapshotLink\$pos" href="cache?q=13951108999&url=http%3A%2F%2Fwww.707070.cn%2Fqiye%2Fcard-8910915.html&" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'snapshot.\$pos', 'PAGE_CLICK','','','','normal');">快照</a></div></div></div></li><li class="res-list"><div class="rnw default"><div class="tl"><h3><a href="http://tw.chahaoba.com/index.php?oldid=777144&title=1395110" id="hitURL\$pos"onmousedown="javascript:ct(this, '13951108999', '\${pos}.1', 'OPEN_HIT', '', '', '','normal');"target="_blank"><span id="title\$pos">1395110 电话区号查询|手机号码归属- 查号吧www.ChaHaoBa.com</span></a></h3></div><div id="summary\$pos"><p>13951108:13951108000-<span class="hl">13951108999</span> 13951109:13951109000-13951109999 安全提示:因为存在用电话诈骗、短信陷阱、引诱回拨国际长途、引诱回拨收费声讯台等陷阱,遇...</p><div class="result-footer"><cite>tw.chahaoba.com/index.php?oldid=777144&title=1395110 - 2016-06-02</cite>- <a class="snapshot" id="snapshotLink\$pos" href="cache?q=13951108999&url=http%3A%2F%2Ftw.chahaoba.com%2Findex.php%3Foldid%3D777144%26title%3D1395110&" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'snapshot.\$pos', 'PAGE_CLICK','','','','normal');">快照</a></div></div></div></li><li class="res-list"><div class="rnw default"><div class="tl"><h3><a href="http://www.nmrxw.com/a/mobile/suzhou_1395110.html" id="hitURL\$pos"onmousedown="javascript:ct(this, '13951108999', '\${pos}.1', 'OPEN_HIT', '', '', '','normal');"target="_blank"><span id="title\$pos">江苏省苏州市1395110号段手机号大全-农民热线网</span></a></h3></div><div id="summary\$pos"><p><span class="hl">13951108999</span> 13951108998 13951108997 13951108996 13951108995 13951108994 13951108993 13951108992 13951108991 13951108990 13951108989 1395110898...</p><div class="result-footer"><cite>www.nmrxw.com/a/mobile/suzhou_1395110.html - 2015-12-15</cite>- <a class="snapshot" id="snapshotLink\$pos" href="cache?q=13951108999&url=http%3A%2F%2Fwww.nmrxw.com%2Fa%2Fmobile%2Fsuzhou_1395110.html&" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'snapshot.\$pos', 'PAGE_CLICK','','','','normal');">快照</a></div></div></div></li></ol><script type="text/javascript">window.time.CT=(new Date()).getTime();</script><div class="c-relatedkeys "><table><caption>相关搜索:</caption><tbody><tr><td><a onmousedown="javascript:ct(this, '"{"query":"13951108999","result":[],"version":"c"}"', 'result.relatedQuery', 'RELATEDQUERY_CLICK','','','','normal');"href='search?q=%22%7B%22query%22%3A%2213951108999%22%2C%22result%22%3A%5B%5D%2C%22version%22%3A%22c%22%7D%22&start=0&ue=utf8&keyfrom=web.related&lq=13951108999&rqp=0'>"{"query":"13951108999","result":[],"version":"c"}"</a></td></tr></tbody></table></div></div></div><div class="c-leftnav"><div class="c-lnv" id="rstype"><ul><li><strong>网页结果</strong></li><li><a href="http://news.youdao.com/search?keyfrom=web.precom&q=13951108999">新闻</a></li><li><a href="http://video.youdao.com/search?keyfrom=web.precom&q=13951108999">视频</a></li><li><a href="http://image.youdao.com/search?keyfrom=web.precom&q=13951108999">图片</a></li></ul></div></div><div id="ext"><div id="splink"><p class="gray">赞助商链接</p><ul class="rz"><li><a class="black"href='http://sou114.58.com.cn/58show6.php?keyfrom=youdao&key5=13951108999'target=_blank onmousedown="javascript:ct(this, '13951108999', '58show6.right', 'CNNIC_CLICK');">精选热门<span class="hl">13951108999</span>,点此查看!</a></li><li><a class="black"href='http://sou114.58.com.cn/58show.php?keyfrom=youdao&key5=13951108999'target=_blank onmousedown="javascript:ct(this, '13951108999', '58show.right', 'CNNIC_CLICK');">找最新<span class="hl">13951108999</span>,点此进入</a></li><li><a class="gray" href="http://a.youdao.com" target="_blank">在此展示您的推广信息</a></li></ul></div></div></div></div><div class="c-bsearch"><form onsubmit="tlSBT('T1')" method="get" action="/search" class="c-fm-w" ><span class="s-inpt-w" ><input type="text" class="s-inpt" autocomplete="off" name="q" id="" value="13951108999" /></span><span class="s-btn-w"><input type="submit" class="s-btn" value="搜 索"/></span><input type="hidden" name="lq" value="13951108999" /><input type="hidden" name="ue" value="utf8" /><input id="T1" type="hidden" name="T1" value="-1" /><input type="hidden" name="keyfrom" value="web.bottom" /><div class="sg-wrap" style="width:519px;display:none"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td valign="top"><ul class="sg-result-list"></ul></td><td class="sob-wrap" style="display:none;"></td></tr></table></div></form><div class="fblinks"><a href="http://survey2.163.com/html/npsofyoudaosearch1105/paper.html" target="_blank" onmousedown="javascript:ct(this, '13951108999', 'survey', 'OPEN_HIT')">满意度调查</a>&nbsp;&nbsp;|&nbsp;<a href="http://feedback.youdao.com/quality_report.jsp?q=13951108999&prodtype=websearch&email=" onmousedown="javascript:ct(this, '13951108999', 'feedback', 'OPEN_HIT')">反馈意见</a></div></div><div id="c_footer"><a href="http://a.youdao.com/">企业推广</a><span class="c_fnl">|</span><a href="http://www.youdao.com/about">关于有道</a><span class="c_fnl">|</span><a href="http://i.youdao.com">官方博客</a><span class="c_fnl">|</span><a href="http://job.youdao.com">诚聘英才</a><p class="c_fcopyright">&copy;2016 网易公司 <a href="http://www.youdao.com/terms/privacy.html">隐私政策</a> <a href="http://www.youdao.com/terms/index.html">服务条款</a> 京ICP证080268号 京公网安备11010802020092号</p></div></div><div data-skin="http://shared.ydstatic.com/images/skins/default/skin-searchresult.png" id="custheme"> </div><div style="position:absolute;display:none;" class="preview-box" id="prv-window"><div class="preview-arrow" id="prv-arr"><em>◆</em><span>◆</span></div><div class="preview-box-cont"><a id="close_prv" href="javascript:void(0)" class="preview-close" title="关闭">×</a><div class="preview-top"><div  id="title_text"></div><p class="preview-serchwords">查找:<a href="javascript:void(0)"><span class="hl1" href="javascript:gotoNextKey(1)"title="寻找下一个“13951108999”">13951108999</span></a></p></div><div class="preview-detail" id="view_content"></div></div></div><script type="text/javascript">var ctImagesCache=[];function tlSBT(b){document.getElementById(b).value=""+(new Date).getTime()}function ct(h,b,g,d,j,c,f,k){var e=new Image();if(typeof(f)=="undefined"){f=""}else{if(f.length>0&&f[0]!="&"){f="&"+f}}if(typeof k=="undefined"){k=""}else{if(k.length>0&&k[0]!="&"){k="&testtype="+k}}e.src="http://www.youdao.com/ctlog?q="+b+"&url="+encodeURIComponent(h.href)+"&pos="+g+"&modifiers="+j+"&action="+d+"&hitSource="+c+f+k;ctImagesCache.push(e);return true}function seturl(e,d,f,h,i){e.href="http://"+f+".youdao.com/";i||(i="search?q=");if(window.RegExp&&window.encodeURIComponent){d=document.getElementById(d).value;if(d!=""){d=d.replace(/(link:)|(inlink:)|(^related:)/,"");e.href=e.href+i+encodeURIComponent(d)+"&keyfrom="+h;}}return true;}</script><script type="text/javascript"  src="http://shared.ydstatic.com/dao/search/outweb/js/yd.js?201311221"></script><script type="text/javascript"  src="http://shared.ydstatic.com/dao/search/outweb/js/suggest-new.js?201311221"></script><script type="text/javascript" src="scripts/tgl.js"></script><script type="text/javascript">window.time.T5 = (new Date()).getTime();(function (YD) {var transData = function (data) {var r = [], s = data.s, i = 0, l = s.length;for (; i < l; i++) {r.push({'c': s[i]});}return r;};var sug = YD.ui.suggest({source:"http://sug.so.360.cn/suggest/word?callback=YD.updateCall&encodein=utf-8&encodeout=utf-8&word=",menu: YD.cn("sg-wrap")[0], transData: transData}, "query");window.onload = function() {window.time.T6 = (new Date()).getTime();YD.buildScript("http://shared.ydstatic.com/dao/search/outweb/js/packed_tgl_new.js?201311221");};})(getNS());</script></body></html>
`;

var pattern = /:沈林海/g
var indexes = [];

while (true) {
  var ret = pattern.exec(txt);
  if (ret === null) {
    break;
  }
  indexes.push(ret.index);
}

console.log("'沈林海' at: ", indexes);



顶部