javascript - efficient method to replace multiple words in text -


To use Javascript, I need to effectively remove ~ 10000 keywords from ~ 100000 word documents, of which ~ 1000 keywords will you suggest, which approach?

Will a regular massive expression be practical? Or should I just be able to find documents that are searching for keywords (boring) through letters?

EDIT:
Good point - not just whole words, parts. And some keywords include spaces.
I am trying to do all the client side to reduce the pressure on the backend. Using regular expressions can be a good option:

<
> Var word = ['bone', 'nuts']; 'Jo Bon Joe Mad' (New 'RegExp (' ('+ words.join (' | ') +') ',' g '),' '); // 'joe joe'

regex 1 is not very complicated with things like back-to-back, and regexp engine is written in C / C ++ , Then you can expect it to be very fast. Yet - benchmark and see if the performance meets your needs.

I do not think it will be faster to implement your own parser, but I may be wrong - Benchmark

The document on the server is not very good for me, with 100k words you are looking at a payload in the megabyte range, and you have to do anything with it on the server and push it back.


1 You may need to tune the RCEXP to something with spaces.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -