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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expressions help 2

Status
Not open for further replies.

RobSchultz

Programmer
Jun 1, 2000
444
US
Please excuse me for posting a pseudo-VB related question here but I sure could use some help from the original grep artists...

I'm trying to code a Visual Basic app that will read in a line of an ini file and pull out parameters.

The .ini would look similar to this:
Code:
[parameters]
T1 = [[parameter 1]][[parameter 2]][[parameter 3]]

The regular expression needs to be able to create a match collection that matches the groups of [[...]] into separate items.

The best I've been able to do (which isn't much) is with the pattern "\[\[(.*)\]\]". This returns a single match of the entire line (yes, Global is on).

Thanks in advance for any help you can provide, Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
I haven't tried this but it should find the first field. I assume the () pair saves the field in some vb variable.
Code:
\[\[([^\]]*)\]\]
Hope this helps. CaKiwi
 
Thank you both for responding. I cross-posted this in one of the VB forums and received an answer that was very similar to your posts. As such, I believe you all warrant a helpful-post star.

I have once again been educated :)I by fellow tek-tips members.

Thanks,
Rob Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top