Regex : how to get words from a string (C#)

后端 未结 6 652
半阙折子戏
半阙折子戏 2020-12-02 21:40

My input consists of user-posted strings.

What I want to do is create a dictionary with words, and how often they’ve been used. This means I want to parse a string,

6条回答
  •  旧巷少年郎
    2020-12-02 22:17

    You don't necessarily need a regex for this, if tokenizing is all you're doing. First you could sanitize the string by removing all non-letter characters except for spaces and then do a Split() on the space character. That will work for most everything, although contractions may be tough. That should get you started at least.

提交回复
热议问题