I'm looking for a way to get strings from a string with specific tags, e.g. I have this string: "Hello <date> My <name> is <your name>" I need to return this: <date> <name> <your name>
"Hello <date> My <name> is <your name>"
<date>
<name>
<your name>
in an array or a list
only words starts and ends with <>.
Thanks a million! :-)
You can use the Regex pattern <.*?> to retrieve each word, ie
<.*?>
MatchCollection matches = Regex.Matches(input, "<.*?>");
You can then iterate over the collection to get the tags.
2.1m questions
2.1m answers
60 comments
57.0k users