I want to find two or more variable in a string with Regex. For instance I have an string like this “Result = Num + 2 ( 6 * Count )”. I want to find out if “Result”, “Num” and “Count” are in this string or not. Suppose that I want to build a small compiler and these Strings are my reserved words and I want to use regex for this checks.
Case sensitive is more important for me. For example if client inputs “num” or “count” in a string, the method must return false.
How can I do it in C#?
Update to use arbitary word collection
resultswill be an array of matching wordsHowever if as you state as your comment in another answer you are building a small compiler you would be better off building a tokenising engine. For example Build a Better Tokeniser