Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read line when string is matched

Status
Not open for further replies.

mastermindg

IS-IT--Management
Jan 28, 2009
7
So, I've got a script that reads multiple config files for matches (maxconnection) and then outputs if it found a match or not.

I want to visually confirm the match to verify settings in the file:

<add address="*"
maxconnection="2"
/>

This should output as "MaxConnections are set to 2".

The problem is that it seems that character(1) is 1 character after the line that maxconnection is on, because when I do a Read (objFile.Read or ObjFile.ReadLine) is only ouputs this:

/>

Choosing add address is out of the question because this phrase is prevalent in the file.

Any help is appreciated. Thanks.
 
Pardon my ignorance. I figured it out. I modified my regex statement so that it took into account variable values:

objRegEx1.Pattern = "maxconnect.+?\x22$
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top