From your last post I would then change the RegEx pattern to "^(W|L)(\d{6})" to match

Quote:

to check if the first letter is a w or l and then verify that there are 6 numbers following the w/l.




If you have other patterns that need to be found, I would be happy in assisting you with the pattern.


Since you are not wanting to extract the pieces of the string like your first post seemed to indicate, I would suggest using a different UDF to just verify that match exists.

Various patterns:
"^(W|L)(\d{6})" matches beginning of string; could have other characters after the 6th digit.
"^(W|L)(\d{6})$" matches explicit 7 character string. "^" beginning of string; "$" end of string.


Code:
break ON

$nodes = "L1A3456789", "L123456789"
$RegExPattern = "^(W|L)(\d{6})"

for each $node in $nodes
if RegExpTest($RegExPattern, $node, 1)
? "-Found match: " + $node
else
? "-No Match found: " + $node
endif
next

Function RegExpTest($Pattern, $String, $IgnoreCase)

Dim $regEx, $Match, $Matches ; Create variable.

$regEx = createobject("VBscript.RegExp") ; Create a regular expression.

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

$RegExpTest = $regEx.Test($String) ; Execute test search.
EndFunction

_________________________
Home page: http://www.kixhelp.com/hb/