Quantcast
Channel: CodeProject Latest postings for Regular Expressions
Viewing all articles
Browse latest Browse all 224

can someone tell me whats wrong with this expression?

$
0
0
pretty new to regex. this is a great article.
 
can someone tell me whats wrong with my expression? I'm using this from C#. I'm getting the response from a blog in a malformed xml format. Need to extract entries out of it. In a simple format inpu is similar to the following.
 
string input = @"<entry><id>tag:myblog.com try</entry><entry><id>tag:myblog.com tryagain</entry><entry><id>tag:myblog.com hello </enty>";
 
I need to identify the number of entries, and then processing each of them.
 
Regex blogsRegEx = new Regex(@"<entry><id>tag:myblog.*</entry>");

MatchCollection blogEntries = blogsRegEx.Matches(input);
 
I always get just 1 entry. It matches the whole thing instead of matching multiple strings in the pattern <entry<id>tag:myblog....</entry>.
 
Can someone help what am I missing here? do i need to use subexpressions here?

Viewing all articles
Browse latest Browse all 224

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>