Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 my regex doesn take \r \n into account

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-01-25 : 11:51:47
How to add the string \r\n to be taken into account in my regex pls
Hi, I have to maintain this can u help mer pls telling me why the regex does n find my sentence in the document:L

[COLOR=DarkSlateBlue]Regex objAlphaNumericPattern = new Regex(">[ ]*[\\s]*[a-zA-Z0-9\x0600-\x06ff\x00DF\\r\\n,'?.\\-\\(\\):\"'&+!/?àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿâêôûÄéÆÇàèÊùÌÍÎÏ][a-zA-Z0-9\x0600-\x06ff\x00DF,'?.\\-\\(\\):&\"'+!/?\\sàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿâêôûÄéÆÇàèÊùÌÍÎÏ]+[ ]*<");[/COLOR]
Here is the target sentence:

[COLOR=DarkSlateBlue]MatchCollection result = objAlphaNumericPattern.Matches("<span class=ms-formvalidation>*</span>\r\n indicates a required field</span>");[/COLOR]
It s the \r\n that s causing the problem because if i remove then my regex matches the sentence without \r\n like this:
[COLOR=DarkSlateBlue]MatchCollection result = objAlphaNumericPattern.Matches("<span class=ms-formvalidation>*</span> indicates a required field</span>");[/COLOR]
Thank you


Thanks
   

- Advertisement -