I'm looking to implement a word count algorithm. However, anything that appears within `~two tildes~` is regarded as 1 word. For this reason I think regex is probably the best way to go?

The count must be calculated on every keypress on sample sets of about 10000 characters so it's good to get it right.