|
thank you my friend
your code work correctly
the problem is i didnt call navigate methode of webBrowser with about:blank value parameter
thank you very mutch
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Guess I should have mentioned that.
Well good to hear you got it working.
|
|
|
|
|
Hey All,
I am experiencing a strange issue, i have built and tested my RegEx in Expresso but when I call it from my code (C#) I am not getting any matches. If i step through and grab the values from the variables and put those in Expresso it works ....
RegEx:
Lead\sID\sNumber:\s*(?<LeadNumber>[^\r\n]*)(?:\r\n)+<br />
Prospect\sName:.*(?:\r\n)+<br />
Prospect\sContact:.*(?:\r\n)+<br />
Prospect\sPhone:.*(?:\r\n)+<br />
Marketing\sCampaign:.*(?:\r\n)+<br />
Prospect\sInformation:\s*(?:\r\n)+<br />
===============\s(?:\r\n)+<br />
(?<Company>[^\r\n]*)(?:\r\n)+<br />
(?<Address1>[^,]*),\s(?<Address2>[^\r\n]*)(?:\r\n)+<br />
(?<City>[^,]*),\s(?<State>[^\r\n]*)(?:\r\n)+<br />
(?<Country>[^,]*),\s(?<Zip>[^\r\n]*)(?:\r\n)+<br />
Contact\sName:\s*(?<FirstName>[^\s]*)\s(?<LastName>[^\r\n]*)(?:\r\n)+<br />
Contact\sPhone:\s*(?<Phone>[^\r\n]*)(?:\r\n)+
C#:
<br />
MatchCollection myMatches = Regex.Matches([Text], [RegEx], RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.CultureInvariant);<br />
[Text] = the body of an email
[RegEx] = the above pattern
Any input or ideas would be greatly appreciated.
|
|
|
|
|
If you can provide some sample text that this Regex should match, it might help.
|
|
|
|
|
Thank you for you reply,
Here is a sample of the text to match.
<br />
Lead Overview: <br />
=========== <br />
Lead ID Number: 1234567 <br />
Prospect Name: Some Prospect<br />
Prospect Contact: Some Contact<br />
Prospect Phone: 1234567890 <br />
<br />
Marketing Campaign: Marketing Campaign Example<br />
<br />
Prospect Information: <br />
=============== <br />
Company Name<br />
Address1, Address2 <br />
New York, NY <br />
United States, 12345 <br />
<br />
Contact Name: Some Contact <br />
Contact Phone: 1234567890 <br />
Company Email: contact@email.com <br />
|
|
|
|
|
Your regex works fine. It is finding the match.
string sMatch = @" Lead Overview:
===========
Lead ID Number: 1234567
Prospect Name: Some Prospect
Prospect Contact: Some Contact
Prospect Phone: 1234567890
Marketing Campaign: Marketing Campaign Example
Prospect Information:
===============
Company Name
Address1, Address2
New York, NY
United States, 12345
Contact Name: Some Contact
Contact Phone: 1234567890
Company Email: contact@email.com";
bool IsMatchFound = Regex.IsMatch(sMatch, @"Lead\sID\sNumber:\s*(?<LeadNumber>[^\r\n]*)(?:\r\n)+Prospect\sName:.*(?:\r\n)+Prospect\sContact:.*(?:\r\n)+Prospect\sPhone:.*(?:\r\n)+Marketing\sCampaign:.*(?:\r\n)+Prospect\sInformation:\s*(?:\r\n)+===============\s(?:\r\n)+(?<Company>[^\r\n]*)(?:\r\n)+(?<Address1>[^,]*),\s(?<Address2>[^\r\n]*)(?:\r\n)+(?<City>[^,]*),\s(?<State>[^\r\n]*)(?:\r\n)+(?<Country>[^,]*),\s(?<Zip>[^\r\n]*)(?:\r\n)+Contact\sName:\s*(?<FirstName>[^\s]*)\s(?<LastName>[^\r\n]*)(?:\r\n)+Contact\sPhone:\s*(?<Phone>[^\r\n]*)(?:\r\n)+");
|
|
|
|
|
Hello D@nish,
First of all i would like to thank both you and Riced.
I have found the solution to my problem and its still kinda strange.
There was actually two problems;
- for some strange reason I cant declare my RegEx string using a literal (using @ when assiging the string) if the literal spans multiple lines, for some reason this is messing with my RegEx.
Which is why i guess in your example its working.
- the emails are being retrieved from Exchange via WebDAV and for some strange reason line breaks are only coming back as '\n' not '\r\n' like they should. So if I do a .Replace("\n","\r\n") on the body everything works fine.
I guess this wasnt a problem for your in your example because the email body was assigned as a literal and therefore had the "proper" line breaks (\r\n)
Thanks again for your help guys, i never would have found this without your help.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
Great!!!
|
|
|
|
|
Instead of doing a string.Replace, you could also change (?:\r\n)+ to [\r\n]+ , which should match any kind of newline
|
|
|
|
|
I assume that you are setting some variable (e.g. myRE) to the regex string.
Are you using a verbatim string i.e. myRE = @"Lead....(\r\n)+" or just doing myRE = "Lead...(\r\n)+" ?
I think it should be a verbatim string otherwise \ is interpreted before Regex.Matches sees it.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Thank you for your reply.
Yes it is "Verbatum" assinged using @
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
Just noticed that there's no test for "===========" after the Lead line.
Is that the problem?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Hi David,
You are right, nice catch.
However that shouldn't effect the matching.
Now I did solve my problem, look above for the solution.
Thanks for your help.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
hi friends
i need a html editor for my application
but i didnt find. i have some editor base on web application but no one can use in windows application
do u know a html editor that can use in c# application(windows base)?
please help me
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Do you want to create html file or HTML help files with .chm extension? Please verify that!
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
Hello,
You should take a look at the DesignMode property of the WebBrowser Control.
If you switch it to "on" it turns the WebBrowser Control into a WYSISYG (What You See Is What You Get) editor.
Then you can get the HTML from the WebBrowser Control.
Check out this great article on how to use the WebBrowser Control
Using the WebBrowser control in .NET[^]
|
|
|
|
|
my friend thank you for ur reply
but i need a html/text editor like gmail editor for writting message but with bit different and the different is that i want use this html/text editor in my windows application project.(c#.net)
in this article i didnt see some place for input html source or editing source with toolbar menu like office
are u sure that this article is usefull for me?
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
The article will show you how to place the a WebBrowser control onto your form, and it shows you how to switch DesignMode "on".
After that all the other functionality (i.e. editing source with toolbar menu like office) you would have to build yourself.
You can access the complete HTMLDocument by using the Document property on the WebBrowser control then use that to insert elements from your menu.
More info on the WebBrowser: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx[^]
|
|
|
|
|
thank you for ur reply
i am going to test it !!!
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
Hi Friends,
I need to know that, is it possible to print '"' on the Console? I try to do this by this code: System.Console.WriteLine(""");
However, this doesn't work because declaring a single " marks the beginning of the string and declaring another " marks the end. Whatever be it, please tell me whether its possible to print (") on the screen? {excluding the () brackets}
Cheers,
Rajdeep.NET
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
Yes it is, simply do
System.Console.WriteLine("\"");
|
|
|
|
|
Thanks Vestras,
It worked!
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
|
|
I'm trying to roll up some old (originally .net 1.1) abstract classes into generics. The classes in question all provide similar functionality for a data object of a specific type. For the most part things are going well, but I've ran into a few places where one one of the data objects is of a type that needs extra processing in one method beyond what all the other types need. I can check the type of T to see if it's the type I need to do the special processing for, but the cast from T to SpecialType won't compile. Is there a different way I can do this, or is what I want to do impossible?
class MyGenericClass<T> : ICloneable where T: class, new()
{
private T m_storedClass;
...
private DoStuff()
{
if (typeof(T) == typeof(SpecialType))
{
((SpecialType)m_storedClass).SpecialString = "foo";
}
}
The European Way of War: Blow your own continent up.
The American Way of War: Go over and help them.
|
|
|
|