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

Searching positions in a string?

Status
Not open for further replies.

DANZIG

Technical User
Mar 8, 2001
142
US
Hello All,

I'm working on a script to search for the values in an SMS mif, I'm sure that many of you know what the invormation in a mif looks like. All vaules are enclose in ()'s, some values are for the form and some values are machine/user information. The locations of the form data and the user/machine data are static in order but not in string length.

It would look something like this:
(1)(don't want)(don't want)(3)(4)(howdy)(6)(1)(hola)(13)(7)


In perl I would use an expression like this:
$line = "(1)(don't want)(don't want)(3)(4)(howdy)(6)(1)(hola)(13)(7)"
if ( $line=~/((.*?))/ ){print "$_\n";}


I'm not sure as to how to pull the values in vbs though. Does anybody know what a similar expression would look like in vbs?


Thanks in advance.
 
i dont know if this is the proper way but you could split the string on ")("

mifarray = split(mif,")(")

then remove the first '(' and the last ')'

somthing like:
1stvar = right(mifarray(0),len(mifarray(0))-1)
lastvar = left(mifarray(0),len(mifarray(0))-1)



===============
Security Forums
 
Thanks Browolf, it works like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top