473,385 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Regex matching failure

I'm using the regex class to try and search a string for line feeds,
carriage returns, and tabs. In a windows test app, I can enter the
expression of \\[rnt] and this works fine. But in the ASP.net app, the same
expression does not work, even though the same process and test strings are
being used. Here's the set of code to test this process on the ASP.net page
that I'm using:

string strExpression = @"\\[rnt]";
System.Text.RegularExpressions.Regex objRegEx = new Regex(strExpression);
System.Text.RegularExpressions.Match objMatch = objRegEx.Match(strMsgBody);

Again, note that this works using the windows forms app. The only difference
is that the expression is input into a text box. Just for grins, I put a
text box on the ASP.net page and entered the expression there as well -
still no success.

Anybody have any thoughts on this?

Thanks in advance,
Dan
Nov 18 '05 #1
6 1763

Unless I'm missing something, your expression matches the literal backslash,
followed by one of the literals r, n, or t. I believe the expression should
read:

[\r\n\t]
Brian Davis
http://www.knowdotnet.com

"Dan Hargrove zau.net>" <dhargrove@har<rmvMe> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl...
I'm using the regex class to try and search a string for line feeds,
carriage returns, and tabs. In a windows test app, I can enter the
expression of \\[rnt] and this works fine. But in the ASP.net app, the same expression does not work, even though the same process and test strings are being used. Here's the set of code to test this process on the ASP.net page that I'm using:

string strExpression = @"\\[rnt]";
System.Text.RegularExpressions.Regex objRegEx = new Regex(strExpression);
System.Text.RegularExpressions.Match objMatch = objRegEx.Match(strMsgBody);
Again, note that this works using the windows forms app. The only difference is that the expression is input into a text box. Just for grins, I put a
text box on the ASP.net page and entered the expression there as well -
still no success.

Anybody have any thoughts on this?

Thanks in advance,
Dan

Nov 18 '05 #2

Unless I'm missing something, your expression matches the literal backslash,
followed by one of the literals r, n, or t. I believe the expression should
read:

[\r\n\t]
Brian Davis
http://www.knowdotnet.com

"Dan Hargrove zau.net>" <dhargrove@har<rmvMe> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl...
I'm using the regex class to try and search a string for line feeds,
carriage returns, and tabs. In a windows test app, I can enter the
expression of \\[rnt] and this works fine. But in the ASP.net app, the same expression does not work, even though the same process and test strings are being used. Here's the set of code to test this process on the ASP.net page that I'm using:

string strExpression = @"\\[rnt]";
System.Text.RegularExpressions.Regex objRegEx = new Regex(strExpression);
System.Text.RegularExpressions.Match objMatch = objRegEx.Match(strMsgBody);
Again, note that this works using the windows forms app. The only difference is that the expression is input into a text box. Just for grins, I put a
text box on the ASP.net page and entered the expression there as well -
still no success.

Anybody have any thoughts on this?

Thanks in advance,
Dan

Nov 18 '05 #3
BTW, if anyone is interested, there is an excellent freeware application for
woking with and testing Regular Expressions. You can download it from the
following URL:

http://www.weitz.de/regex-coach/

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Brian Davis" <@> wrote in message
news:Oz**************@TK2MSFTNGP10.phx.gbl...

Unless I'm missing something, your expression matches the literal backslash, followed by one of the literals r, n, or t. I believe the expression should read:

[\r\n\t]
Brian Davis
http://www.knowdotnet.com

"Dan Hargrove zau.net>" <dhargrove@har<rmvMe> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl...
I'm using the regex class to try and search a string for line feeds,
carriage returns, and tabs. In a windows test app, I can enter the
expression of \\[rnt] and this works fine. But in the ASP.net app, the

same
expression does not work, even though the same process and test strings

are
being used. Here's the set of code to test this process on the ASP.net

page
that I'm using:

string strExpression = @"\\[rnt]";
System.Text.RegularExpressions.Regex objRegEx = new Regex(strExpression); System.Text.RegularExpressions.Match objMatch =

objRegEx.Match(strMsgBody);

Again, note that this works using the windows forms app. The only

difference
is that the expression is input into a text box. Just for grins, I put a
text box on the ASP.net page and entered the expression there as well -
still no success.

Anybody have any thoughts on this?

Thanks in advance,
Dan


Nov 18 '05 #4
BTW, if anyone is interested, there is an excellent freeware application for
woking with and testing Regular Expressions. You can download it from the
following URL:

http://www.weitz.de/regex-coach/

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Brian Davis" <@> wrote in message
news:Oz**************@TK2MSFTNGP10.phx.gbl...

Unless I'm missing something, your expression matches the literal backslash, followed by one of the literals r, n, or t. I believe the expression should read:

[\r\n\t]
Brian Davis
http://www.knowdotnet.com

"Dan Hargrove zau.net>" <dhargrove@har<rmvMe> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl...
I'm using the regex class to try and search a string for line feeds,
carriage returns, and tabs. In a windows test app, I can enter the
expression of \\[rnt] and this works fine. But in the ASP.net app, the

same
expression does not work, even though the same process and test strings

are
being used. Here's the set of code to test this process on the ASP.net

page
that I'm using:

string strExpression = @"\\[rnt]";
System.Text.RegularExpressions.Regex objRegEx = new Regex(strExpression); System.Text.RegularExpressions.Match objMatch =

objRegEx.Match(strMsgBody);

Again, note that this works using the windows forms app. The only

difference
is that the expression is input into a text box. Just for grins, I put a
text box on the ASP.net page and entered the expression there as well -
still no success.

Anybody have any thoughts on this?

Thanks in advance,
Dan


Nov 18 '05 #5
Damn, that worked. Weird, but I didn't need to do that in the windows app I
was using. I'll have to look into that one just so I know wtf happened.

Thanks!
"Brian Davis" <@> wrote in message
news:Oz**************@TK2MSFTNGP10.phx.gbl...

Unless I'm missing something, your expression matches the literal backslash, followed by one of the literals r, n, or t. I believe the expression should read:

[\r\n\t]
Brian Davis
http://www.knowdotnet.com

"Dan Hargrove zau.net>" <dhargrove@har<rmvMe> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl...
I'm using the regex class to try and search a string for line feeds,
carriage returns, and tabs. In a windows test app, I can enter the
expression of \\[rnt] and this works fine. But in the ASP.net app, the

same
expression does not work, even though the same process and test strings

are
being used. Here's the set of code to test this process on the ASP.net

page
that I'm using:

string strExpression = @"\\[rnt]";
System.Text.RegularExpressions.Regex objRegEx = new Regex(strExpression); System.Text.RegularExpressions.Match objMatch =

objRegEx.Match(strMsgBody);

Again, note that this works using the windows forms app. The only

difference
is that the expression is input into a text box. Just for grins, I put a
text box on the ASP.net page and entered the expression there as well -
still no success.

Anybody have any thoughts on this?

Thanks in advance,
Dan


Nov 18 '05 #6
Damn, that worked. Weird, but I didn't need to do that in the windows app I
was using. I'll have to look into that one just so I know wtf happened.

Thanks!
"Brian Davis" <@> wrote in message
news:Oz**************@TK2MSFTNGP10.phx.gbl...

Unless I'm missing something, your expression matches the literal backslash, followed by one of the literals r, n, or t. I believe the expression should read:

[\r\n\t]
Brian Davis
http://www.knowdotnet.com

"Dan Hargrove zau.net>" <dhargrove@har<rmvMe> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl...
I'm using the regex class to try and search a string for line feeds,
carriage returns, and tabs. In a windows test app, I can enter the
expression of \\[rnt] and this works fine. But in the ASP.net app, the

same
expression does not work, even though the same process and test strings

are
being used. Here's the set of code to test this process on the ASP.net

page
that I'm using:

string strExpression = @"\\[rnt]";
System.Text.RegularExpressions.Regex objRegEx = new Regex(strExpression); System.Text.RegularExpressions.Match objMatch =

objRegEx.Match(strMsgBody);

Again, note that this works using the windows forms app. The only

difference
is that the expression is input into a text box. Just for grins, I put a
text box on the ASP.net page and entered the expression there as well -
still no success.

Anybody have any thoughts on this?

Thanks in advance,
Dan


Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: alphatan | last post by:
Is there relative source or document for this purpose? I've searched the index of "Mastering Regular Expression", but cannot get the useful information for C. Thanks in advanced. -- Learning...
3
by: Dan Hargrove | last post by:
I'm using the regex class to try and search a string for line feeds, carriage returns, and tabs. In a windows test app, I can enter the expression of \\ and this works fine. But in the ASP.net app,...
3
by: Dan Hargrove | last post by:
I'm using the regex class to try and search a string for line feeds, carriage returns, and tabs. In a windows test app, I can enter the expression of \\ and this works fine. But in the ASP.net app,...
8
by: Bob | last post by:
I need to create a Regex to extract all strings (including quotations) from a C# or C++ source file. After being unsuccessful myself, I found this sample on the internet: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.