I'm in C#, and let's say I have this String:
String input = "some text with <<test>> and <<test2>> thrown in for fun";
and I have this Regex with loop:
Regex literals = new Regex(@"\<<([^\>]+)\>>");
foreach(Match match in literals.Matches(input))
{
Console.WriteLine("\"" + match.Value + "\"");
}
I don't get
"<<test>>"
"<<test2>>"
but instead I get
"<<test>><<test2>>"
I know just enough about regular expressions to be useful when I need them, but frankly it's mostly Greek to me. I have strings that use that
<<text>>
sort of format to denote where user input goes (it's for some old, old software, I don't get how to store the strings) in some custom commands, and some of the commands might have ten of those fields in them, and my regex matches loop returns everything between the first and the last carrots. Here's a real world example that is short enough to consume:
<< Enter the reference number you would like to search for >><< Enter a
specific date or leave blank to search the last 60 days.
Example: xx/xx/xxxx >>
should be
<< Enter the reference number you would like to search for >>
<< Enter a specific date or leave blank to search the last 60 days.
Example: xx/xx/xxxx >>