It works ... until you have four comma delimited fields instead of three before the final digit field. .* is best used when you care about the beginning and the end of a string but not the stuff in between. A better way is:([^,]*,) for the comma delimited fields you care about, and a regex that carefully matches the pattern of the multiple semicolon delimited fields, such as ((?:\w*;\s+)*):
^([^,]*,)((?:\w*;\s+)*)([^,]*,)([^,]*,)([^,]*,).*,(\d)$
Note the use of .* to skip past any extra fields before the final digit field. Using [^,]* instead of .* means you only grab up to (and not including) the next comma and no more.
Best, beth |