c# - Parsing a regex -


i having trouble writing regular expression in c#; purpose extract words start '@' given string can stored in type of data structure.

if string "the quick @brown fox jumps on lazy @dog", i'd array contains 2 elements: brown , dog. needs handle edge cases properly. example, if it's @@brown, should still produce 'brown' not '@brown'.

something

c#:

string quick = "the quick @brown fox jumps on lazy @dog @@dog"; matchcollection results = regex.matches(quick, "@\\w+");  foreach (match m in results) {     literal1.text += m.value.replace("@", ""); } 

takes care of edge case too. (@@dog => dog)


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -