'###Variable definition area
'The user need to define the name of the metadata that is used as input sSearch = Metadata.Values("metadata")
 
sSearch = Metadata.Values("ZONE_OCR01")
'The user need to define the regular expression to be used on the metadata sPattern(1) = expression

sPattern = "<DD><RE>(.*?)<\/RE>"
call TestRegExp(sPattern, sSearch)

Sub TestRegExp(sPattern, sSearch)
	' Do the regular expression match
	Dim oRE, oMatches
	Set oRE = New RegExp
	oRE.Global = True
	oRE.IgnoreCase = True
	oRE.Pattern = sPattern
	Set oMatches = oRE.Execute(sSearch)
	Dim oMatch
	For Each oMatch In oMatches				
		call Application.Log(99, "Find part: " & oMatch.Value)
		call Application.Log(99, "Find Submatchpart: " & oMatch.Submatches.Item(0))
		call Metadata.SetValues("PART", oMatch.Submatches.Item(0))
	Next
End Sub