0

I wrote simple program for getting info from web

string loginName = null;
Regex rloginName = new Regex(@" <tr><td dir='rtl'><h1>(.*?)</h1><br /></td></tr> <!--.............. Titel der Referat ..............-->");

Match mloginName = rloginName.Match(source);
if (mloginName.Success)
{

}

ok i test this on RegexBuddy 3 every thing is fine but in my code cant get something too return ,

so where is my code problem

here is code :

<tr><td dir='rtl'><h1>xxx:xxx:xxxx:[email protected]</h1><br /></td></tr> <!--.............. Titel der Referat ..............-->     
          <tr><td dir='rtl' style='text-align: justify'>

and i want get

xxx:xxx:xxxx:[email protected]
2
  • 5
    Please provide a test case which you think should match but doesn't. Commented May 15, 2009 at 16:01
  • Also, regex isn't ideal for getting info from HTML/XML formats. Perhaps you'd be better off with a parser? Commented May 15, 2009 at 16:10

2 Answers 2

2

It's the tiny whitespace at the start of your Regex pattern. If you remove it, you can get what you want using mloginName.Groups[1] .

Sign up to request clarification or add additional context in comments.

Comments

0

So is there no whitespace/new lines in the web page?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.