.NETGURU
(.*) ?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngregexp' list.


Rachel Reese
Hi Everyone..
I'm trying to read in a file (sample below) and sort the data (to
eventually be put in a database) based upon whether it's "Local Path",
"Remote Path", etc.

I read in all the lines separately. I get rid of the first few lines
(the ones beginning with "//") with a select case statement and then
have

case else
Dim Expr as string&#":; (.*)"
Dim SearchReg as New RegEx(Expr)
Dim SearchMatch as Match
SearchMatch&#Se;archReg.Match(thisline)
response.write(SearchMatch)
response.write("<BR/>")
sb.append (thisline & "<BR/>")
...
end select

(I was forced to use response.writes because SearchMatch isn't a string
so I couldn't use a trace.write to print it out, apparently....?)

But according to the example in Pro asp.net (page 832) when I search on
"homer(.*)", I'm not supposed to get any occurrence of "homer" in my
results, and I do get the beginning ": " in my results. Should I? How
do I get rid of it?

Or - can you think of a better way to be doing this?

Thanks,
Rachel

//WinMX incomplete downloads
//
//PLEASE DO NOT EDIT THIS FILE

Local Path: C:\My Documents\My Music\NewMusic\Tim Buckley - Strange
Street Affair Under Blue.mp3
Remote Path: c:\dokumente und einstellungen\administrator\eigene
dateien\my music\Tim Buckley - Tim Buckley -04- Strange Street Affair
Under Blue.mp3
Expected Size: 3107655
User: symbiosis
Server: [server5.dtype.org] 64.71.163.205:8888
Entry Time: 08/18/01 12:08:54
Reply to this message...
 
    
Wayne King
A "Match" object represents everything that was matched. In your case, =
you did actually match the colon, so it appears in the output.

Since SearchMatch is not a string, when you do a Response.Write on it, =
it is cast to a string via its ToString() method. And ToString() is =
equivalent to the Value property. So, if you want an explicit string =
from your Match object, use "SearchMatch.Value".

The string you want is within one of the Groups within your SearchMatch =
object. Parenthesized groups are numbered left-to-right starting at =
one. So, this expression should give you the string you want:
    SearchMatch.Groups(1).Value

The docs give a pretty good introduction to how .NET Regexs work:
ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpconcomregularexpressions.ht=
m

-WayneK

-----Original Message-----
From: Rachel Reese [mailto:Click here to reveal e-mail address]
Sent: Monday, October 08, 2001 9:14 AM
To: aspngregexp
Subject: [aspngregexp] (.*) ?

Hi Everyone....=20
I'm trying to read in a file (sample below) and sort the data (to =
eventually be put in a database) based upon whether it's "Local Path", =
"Remote Path", etc. =20
=20
I read in all the lines separately. I get rid of the first few lines =
(the ones beginning with "//") with a select case statement and then =
have

case else
Dim Expr as string=3D": (.*)"
Dim SearchReg as New RegEx(Expr)
Dim SearchMatch as Match
SearchMatch=3DSearchReg.Match(thisline)
response.write(SearchMatch)
response.write("<BR/>")
sb.append (thisline & "<BR/>")
...
end select

(I was forced to use response.writes because SearchMatch isn't a string =
so I couldn't use a trace.write to print it out, apparently....?)

But according to the example in Pro asp.net (page 832) when I search on =
"homer(.*)", I'm not supposed to get any occurrence of "homer" in my =
results, and I do get the beginning ": " in my results. Should I? How =
do I get rid of it? =20
=20
Or - can you think of a better way to be doing this?

Thanks,
Rachel
=20
=20
//WinMX incomplete downloads
//
//PLEASE DO NOT EDIT THIS FILE
=20
=20
=20
=20
Local Path: C:\My Documents\My Music\NewMusic\Tim Buckley - Strange =
Street Affair Under Blue.mp3
Remote Path: c:\dokumente und einstellungen\administrator\eigene =
dateien\my music\Tim Buckley - Tim Buckley -04- Strange Street Affair =
Under Blue.mp3
Expected Size: 3107655
User: symbiosis
Server: [server5.dtype.org] 64.71.163.205:8888
Entry Time: 08/18/01 12:08:54
=20
=20
=20
| [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID | =
http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT | =
http://www.asplists.com/search =3D SEARCH Archives=20

Reply to this message...
 
    
Rachel Reese
Thanks Wayne.
This worked perfectly!

-Rachel

-----Original Message-----
From: Wayne King [mailto:Click here to reveal e-mail address]
Sent: Monday, October 08, 2001 1:38 PM
To: aspngregexp
Subject: [aspngregexp] RE: (.*) ?

A "Match" object represents everything that was matched. In your case,
you did actually match the colon, so it appears in the output.

Since SearchMatch is not a string, when you do a Response.Write on it,
it is cast to a string via its ToString() method. And ToString() is
equivalent to the Value property. So, if you want an explicit string
from your Match object, use "SearchMatch.Value".

The string you want is within one of the Groups within your SearchMatch
object. Parenthesized groups are numbered left-to-right starting at
one. So, this expression should give you the string you want:
    SearchMatch.Groups(1).Value

The docs give a pretty good introduction to how .NET Regexs work:
ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpconcomregularexpressions.h
tm

-WayneK

-----Original Message-----
From: Rachel Reese [mailto:Click here to reveal e-mail address]
Sent: Monday, October 08, 2001 9:14 AM
To: aspngregexp
Subject: [aspngregexp] (.*) ?

Hi Everyone....
I'm trying to read in a file (sample below) and sort the data (to
eventually be put in a database) based upon whether it's "Local Path",
"Remote Path", etc.

I read in all the lines separately. I get rid of the first few lines
(the ones beginning with "//") with a select case statement and then
have

case else
Dim Expr as string=": (.*)"
Dim SearchReg as New RegEx(Expr)
Dim SearchMatch as Match
SearchMatch=SearchReg.Match(thisline)
response.write(SearchMatch)
response.write("<BR/>")
sb.append (thisline & "<BR/>")
...
end select

(I was forced to use response.writes because SearchMatch isn't a string
so I couldn't use a trace.write to print it out, apparently....?)

But according to the example in Pro asp.net (page 832) when I search on
"homer(.*)", I'm not supposed to get any occurrence of "homer" in my
results, and I do get the beginning ": " in my results. Should I? How
do I get rid of it?

Or - can you think of a better way to be doing this?

Thanks,
Rachel

//WinMX incomplete downloads
//
//PLEASE DO NOT EDIT THIS FILE

Local Path: C:\My Documents\My Music\NewMusic\Tim Buckley - Strange
Street Affair Under Blue.mp3
Remote Path: c:\dokumente und einstellungen\administrator\eigene
dateien\my music\Tim Buckley - Tim Buckley -04- Strange Street Affair
Under Blue.mp3
Expected Size: 3107655
User: symbiosis
Server: [server5.dtype.org] 64.71.163.205:8888
Entry Time: 08/18/01 12:08:54

| [aspngregexp] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT |
http://www.asplists.com/search = SEARCH Archives

| [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com

Reply to this message...
 
    
Rachel Reese
Hi Everyone..
I'm trying to read in a file (sample below) and sort the data (to
eventually be put in a database) based upon whether it's "Local Path",
"Remote Path", etc.

I read in all the lines separately. I get rid of the first few lines
(the ones beginning with "//") with a select case statement and then
have

case else
Dim Expr as string&#":; (.*)"
Dim SearchReg as New RegEx(Expr)
Dim SearchMatch as Match
SearchMatch&#Se;archReg.Match(thisline)
response.write(SearchMatch)
response.write("<BR/>")
sb.append (thisline & "<BR/>")
...
end select

(I was forced to use response.writes because SearchMatch isn't a string
so I couldn't use a trace.write to print it out, apparently....?)

But according to the example in Pro asp.net (page 832) when I search on
"homer(.*)", I'm not supposed to get any occurrence of "homer" in my
results, and I do get the beginning ": " in my results. Should I? How
do I get rid of it?

Or - can you think of a better way to be doing this?

Thanks,
Rachel

//WinMX incomplete downloads
//
//PLEASE DO NOT EDIT THIS FILE

Local Path: C:\My Documents\My Music\NewMusic\Tim Buckley - Strange
Street Affair Under Blue.mp3
Remote Path: c:\dokumente und einstellungen\administrator\eigene
dateien\my music\Tim Buckley - Tim Buckley -04- Strange Street Affair
Under Blue.mp3
Expected Size: 3107655
User: symbiosis
Server: [server5.dtype.org] 64.71.163.205:8888
Entry Time: 08/18/01 12:08:54
Reply to this message...
 
    
Wayne King
A "Match" object represents everything that was matched. In your case, =
you did actually match the colon, so it appears in the output.

Since SearchMatch is not a string, when you do a Response.Write on it, =
it is cast to a string via its ToString() method. And ToString() is =
equivalent to the Value property. So, if you want an explicit string =
from your Match object, use "SearchMatch.Value".

The string you want is within one of the Groups within your SearchMatch =
object. Parenthesized groups are numbered left-to-right starting at =
one. So, this expression should give you the string you want:
    SearchMatch.Groups(1).Value

The docs give a pretty good introduction to how .NET Regexs work:
ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpconcomregularexpressions.ht=
m

-WayneK

-----Original Message-----
From: Rachel Reese [mailto:Click here to reveal e-mail address]
Sent: Monday, October 08, 2001 9:14 AM
To: aspngregexp
Subject: [aspngregexp] (.*) ?

Hi Everyone....=20
I'm trying to read in a file (sample below) and sort the data (to =
eventually be put in a database) based upon whether it's "Local Path", =
"Remote Path", etc. =20
=20
I read in all the lines separately. I get rid of the first few lines =
(the ones beginning with "//") with a select case statement and then =
have

case else
Dim Expr as string=3D": (.*)"
Dim SearchReg as New RegEx(Expr)
Dim SearchMatch as Match
SearchMatch=3DSearchReg.Match(thisline)
response.write(SearchMatch)
response.write("<BR/>")
sb.append (thisline & "<BR/>")
...
end select

(I was forced to use response.writes because SearchMatch isn't a string =
so I couldn't use a trace.write to print it out, apparently....?)

But according to the example in Pro asp.net (page 832) when I search on =
"homer(.*)", I'm not supposed to get any occurrence of "homer" in my =
results, and I do get the beginning ": " in my results. Should I? How =
do I get rid of it? =20
=20
Or - can you think of a better way to be doing this?

Thanks,
Rachel
=20
=20
//WinMX incomplete downloads
//
//PLEASE DO NOT EDIT THIS FILE
=20
=20
=20
=20
Local Path: C:\My Documents\My Music\NewMusic\Tim Buckley - Strange =
Street Affair Under Blue.mp3
Remote Path: c:\dokumente und einstellungen\administrator\eigene =
dateien\my music\Tim Buckley - Tim Buckley -04- Strange Street Affair =
Under Blue.mp3
Expected Size: 3107655
User: symbiosis
Server: [server5.dtype.org] 64.71.163.205:8888
Entry Time: 08/18/01 12:08:54
=20
=20
=20
| [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID | =
http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT | =
http://www.asplists.com/search =3D SEARCH Archives=20

Reply to this message...
 
    
Rachel Reese
Thanks Wayne.
This worked perfectly!

-Rachel

-----Original Message-----
From: Wayne King [mailto:Click here to reveal e-mail address]
Sent: Monday, October 08, 2001 1:38 PM
To: aspngregexp
Subject: [aspngregexp] RE: (.*) ?

A "Match" object represents everything that was matched. In your case,
you did actually match the colon, so it appears in the output.

Since SearchMatch is not a string, when you do a Response.Write on it,
it is cast to a string via its ToString() method. And ToString() is
equivalent to the Value property. So, if you want an explicit string
from your Match object, use "SearchMatch.Value".

The string you want is within one of the Groups within your SearchMatch
object. Parenthesized groups are numbered left-to-right starting at
one. So, this expression should give you the string you want:
    SearchMatch.Groups(1).Value

The docs give a pretty good introduction to how .NET Regexs work:
ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpconcomregularexpressions.h
tm

-WayneK

-----Original Message-----
From: Rachel Reese [mailto:Click here to reveal e-mail address]
Sent: Monday, October 08, 2001 9:14 AM
To: aspngregexp
Subject: [aspngregexp] (.*) ?

Hi Everyone....
I'm trying to read in a file (sample below) and sort the data (to
eventually be put in a database) based upon whether it's "Local Path",
"Remote Path", etc.

I read in all the lines separately. I get rid of the first few lines
(the ones beginning with "//") with a select case statement and then
have

case else
Dim Expr as string=": (.*)"
Dim SearchReg as New RegEx(Expr)
Dim SearchMatch as Match
SearchMatch=SearchReg.Match(thisline)
response.write(SearchMatch)
response.write("<BR/>")
sb.append (thisline & "<BR/>")
...
end select

(I was forced to use response.writes because SearchMatch isn't a string
so I couldn't use a trace.write to print it out, apparently....?)

But according to the example in Pro asp.net (page 832) when I search on
"homer(.*)", I'm not supposed to get any occurrence of "homer" in my
results, and I do get the beginning ": " in my results. Should I? How
do I get rid of it?

Or - can you think of a better way to be doing this?

Thanks,
Rachel

//WinMX incomplete downloads
//
//PLEASE DO NOT EDIT THIS FILE

Local Path: C:\My Documents\My Music\NewMusic\Tim Buckley - Strange
Street Affair Under Blue.mp3
Remote Path: c:\dokumente und einstellungen\administrator\eigene
dateien\my music\Tim Buckley - Tim Buckley -04- Strange Street Affair
Under Blue.mp3
Expected Size: 3107655
User: symbiosis
Server: [server5.dtype.org] 64.71.163.205:8888
Entry Time: 08/18/01 12:08:54

| [aspngregexp] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT |
http://www.asplists.com/search = SEARCH Archives

| [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification