I am having trouble writing a regular expression in C#; its purpose is to extract all words that start with ‘@’ from a given string so they can be stored in some type of data structure.
If the string is “The quick @brown fox jumps over the lazy @dog”, I’d like to get an array that contains two elements: brown and dog. It needs to handle the edge cases properly. For example, if it’s @@brown, it should still produce ‘brown’ not ‘@brown’.
something like this
C#:
takes care of your edge case too. (@@dog => dog)