Hi,
If your properties will have <% - %> symbols and you are interested in the
content. Use Eg1, or if you properties are like words (alphanumeric) use eg2.
Eg1,
Reg Ex = "<%([^<%]*?)%>"
Explanation = Look for starting <% and should have again <% but it should
end with
Input string = <%test <%Width=100%> Satheesh <%Height=100%> test%>
then Output
Width=100
Height=100
Eg 2:
RegEx = "[\w]+";
Input string = <%test <%Width=100%> Satheesh <%Height=100%> test%>
output
test
Width
100
Sathee
Height
100
test
Code in C#.
string input = "<%test <%Width=100%> Satheesh <%Height=100%> test%>";
string s1=@"<%([^<%]*?)%>";//(...)
string s2=@"[\w]+";
Regex r = new Regex(s1);
MatchCollection mc= r.Matches(input);
foreach(Match m in mc)
{
Console.WriteLine(m.Groups[1].Value);
}
r = new Regex(s2);
mc= r.Matches(input);
foreach(Match m in mc)
{
Console.WriteLine(m.Groups[0].Value);
}
Satheesh.