【发布时间】:2021-04-30 09:09:40
【问题描述】:
我正在使用 google sheet 和 google webapp crud。为此,我将 HTML 代码添加到谷歌表格的单元格中,以便更好地查看搜索结果输出。
我面临的问题是,当我们进行搜索时。例如我无法过滤梅赛德斯奔驰 C 类,因为我的 HTML 代码 class= 显示了包含 C 类的所有结果。或奥迪 A4 等...
为了避免多余的间距,我使用了这个正则表达式
var searchWords = searchinput.split(/\s+/);
例如,我有这样的 Google 表格单元格。
"<h6>MERCEDES BENZ C200 PREMIUM 2019</h6></b><p style='font-size:12px;color:#808080'>23003 KM</p> <div><a href='https://autodirect.lk/listings/mercedes-benz-c200-premium/'title='Website' target='_blank'><img src='https://img.icons8.com/plumpy/20/000000/technology-items.png'/></a>
<a href='https://docs.google.com/document/d/1l7sIdRPy2_t5_WavkyxoMpyaOMYi5mCBQCK0eQRk/preview'title='Quotation' target='_blank'><img src='https://img.icons8.com/plumpy/20/000000/paper--v1.png'/></a> <a href='https://drive.google.com/drive/folders/1mdASYRRd_bhngPVa0ZHFgDIFRPBOkr1Z'title='Images' target='_blank'><img src='https://img.icons8.com/plumpy/20/000000/camera.png'/></a></div>"
在上面的代码中,我只想检测到下面的内容并避免所有其他对象期望下面的单词
车辆名称和年份MERCEDES BENZ C200 PREMIUM 2019
图片
报价
网站
可以用正则表达式去掉HTML代码吗?
【问题讨论】: