You are using Forms or Workflow to save the template information? It is slightly ambiguous in your question where the regular expression is being used.
I think you mean Workflow. In that case, you should try parsing it at every comma(using a function (split)), making it a multi-value token. Then use the values in the following positions to assign the fields:
you should test for how many values are in the token, to see if you have a second address row in there, or you can do the following to get only the first address row:
- Position 1 from the start is the Address 1
- Position 1 from the end is the Zip Code
- Position 2 from the end is the State
- Position 3 from the end is the City
To Split the token, do this:

If there are 5 values in the token, and you had an Address 2 field to retrieve, then the above setup would still always work, but you would also want to have it take the value in the 2nd position from the start and assign that to your Address 2 field.
To Find out the amount of values for use in a conditional decision, do this:
