Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.0k views
in Technique[技术] by (71.8m points)

请问在JS中new RegExp 如何反向匹配?

例如正常搜索标题是根据关键词搜索;
现在想实现根据标题搜索关键词:
比如标题很长,几十个字符,关键词很多,几万个;
标题:asfhsdajkfhadsfjsdflajlajfld...
几万个关键词:['had','abc'...]

需要筛选出出现在标题中的关键词

关键词几万个,不可能用关键词for标题来匹配吧?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这个可能还真只能用类似for来处理,不过可以认为是链式处理,或者说并行处理,因为这里的关键字互相之间是独立的。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...