For items like this where you want to find text, symbols, or numbers in a line or large text body, I still recommend regular expression.

Code:
$array = "SMTP:kris.lutsock@@ci.test.or.us%X400:c=US;a= ;p=MAC;o=MAC1;s=Lutsock;g=Kris;",
"CCMAIL:SMTP:kris.lutsock@@ci.test.or.us%X400:c=US;a= ;p=MAC;o=MAC1;s=Lutsock;g=Kris;"

for each $text in $array
$Matches = RegExpFind(":([^:]+)%", $text, 1, 0)

? "Quick access to value: " + $Matches[0][1] ?

; accessing match and submatch via loops.
? "Number of matches = " + (1+ubound($Matches))
for each $match in $matches
if Vartypename($match) <> "Empty"
? "Match = " + $match[0]
; Output submatches
for $x=1 to ubound($match)-1
? " SubMatch("+$x+") = " + $match[$x]
next
endif
next
next

Function RegExpFind($Pattern, $String, $IgnoreCase, $Global)

Dim $regEx, $Match, $Matches, $i, $j, $k ; Create variable.
Dim $Results[0]
$regEx = createobject("VBscript.RegExp") ; Create a regular expression.

$regEx.Pattern = $Pattern ; Set pattern.
$regEx.IgnoreCase = val($IgnoreCase) ; Set case insensitivity.
$regEx.Global = val($Global) ; Set global applicability.

$Matches = $regEx.Execute($String) ; Execute search.

$k=0
For Each $Match in $Matches ; Iterate Matches collection.
Dim $MatchValue[0]
ReDim Preserve $Results[$k]

$MatchValue[0] = $Match.Value

if $Match.Submatches.count > 0
for $i=0 to $Match.Submatches.count
ReDim Preserve $MatchValue[$i+1]
$MatchValue[$i+1] = $Match.Submatches($i)
next
endif
$Results[$k] = $MatchValue
$k=$k+1
Next
$RegExpFind = $Results
EndFunction



Edited by Howard Bullock (2006-04-03 08:17 PM)
_________________________
Home page: http://www.kixhelp.com/hb/