Welcome to OGeek Q&A 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 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...