Returning values based on regular expressions matches
Use an IfThenElse function with a Matches function to define an output value depending on the pattern of an input value.
Before you begin
About this task
In this example, you have an XML file containing contact information. You want to check that
				the state and phone elements match a specific
				pattern and indicate whether a contact is valid or invalid using an attribute. You
				can use the following XML sample as
				input:
         
			      <contacts>
	<contact>
		<lastName>Harrison</lastName>
		<firstName>Jane</firstName>
		<street>French Camp Turnpike Road</street>
		<zipCode>30316</zipCode>
		<city>Atlanta</city>
		<state>Georgia</state>
		<phone>(678)123-4567</phone>
	</contact>
	<contact>
		<lastName>Johnson</lastName>
		<firstName>Katherine</firstName>
		<street>Santa Rosa South</street>
		<zipCode>85162</zipCode>
		<city>Phoenix</city>
		<state>AZ</state>
		<phone>(602)789-0123</phone>
	</contact>
	<contact>
		<lastName>Monroe</lastName>
		<firstName>Martin</firstName>
		<street>N Kentwood</street>
		<zipCode>32315</zipCode>
		<city>Tallahassee</city>
		<state>FL</state>
		<phone>(805) 456-7890</phone>
	</contact>
</contacts>You can use the following XML sample to create your output
				structure:
         
		    <contacts>
	<contact status="">
		<lastName/>
		<firstName/>
		<street/>
		<zipCode/>
		<city/>
		<state/>
		<phone/>
	</contact>
	<contact status="">
		<lastName/>
		<firstName/>
		<street/>
		<zipCode/>
		<city/>
		<state/>
		<phone/>
	</contact>
</contacts>Procedure
Results
         
            You can use the Test Run feature to see
					the result. In this example, the following output is returned:
            
         
      <contacts>
  <contact status="invalid">
    <lastName>Harrison</lastName>
    <firstName>Jane</firstName>
    <street>French Camp Turnpike Road</street>
    <zipCode>30316</zipCode>
    <city>Atlanta</city>
    <state>Georgia</state>
    <phone>(678)123-4567</phone>
  </contact>
  <contact status="valid">
    <lastName>Johnson</lastName>
    <firstName>Katherine</firstName>
    <street>Santa Rosa South</street>
    <zipCode>85162</zipCode>
    <city>Phoenix</city>
    <state>AZ</state>
    <phone>(602)789-0123</phone>
  </contact>
  <contact status="invalid">
    <lastName>Monroe</lastName>
    <firstName>Martin</firstName>
    <street>N Kentwood</street>
    <zipCode>32315</zipCode>
    <city>Tallahassee</city>
    <state>FL</state>
    <phone>(805) 456-7890</phone>
  </contact>
</contacts>