FirstIndex property
Back in the search string matches the position.
object.FirstIndex
object parameter is always a Match object.
Explain
FirstIndex property used starting from zero offset, the offset is relative to the search string in terms of starting position. In other words, the first character string is identified as character 0. The following example shows FirstIndex property:
~ Function RegExpTest (patrn, strng) Dim regEx, Match, Matches''to establish variable. Set regEx = New RegExp''the establishment of regular expressions. regEx.Pattern = patrn''set the pattern. regEx.IgnoreCase = True''settings are case-sensitive. regEx.Global = True''set the global availability. Set Matches = regEx.Execute (strng)''perform a search. For Each Match in Matches''traverse Matches collection. RetStr = RetStr & match & I & at RetStr = RetStr & Match.FirstIndex &. Match Value is''RetStr = RetStr & Match.Value &''. & VbCRLF Next RegExpTest = RetStrEnd FunctionMsgBox ( RegExpTest (is., IS1 is2 IS3 is4))
No comments:
Post a Comment