“Reuse another field” is one of the patterns that you can select on the Match panel. If two or more fields need to match the same kind of pattern, but not match exactly the same text, then you need to specify the pattern only for the first field that needs it. For the other fields, you can select “reuse another field” and reference the first field.
![]()
Select the other field to be reused for this field. If your target application supports subroutine calls then RegexMagic generates a subroutine call to the other field. Otherwise, RegexMagic duplicates the part of the regex generated for the other field. Either way, this field will be able to match the same text that could be matched by the other field. But the text that is actually matched does not have to be identical. If the other field can match any letter, for example, then this field will also match any letter. The two fields can end up matching the same or different letters.
A field cannot reuse itself or another field that reuses a 3rd field. But two different fields can reuse the same 3rd field. A field that is inside another sequence or alternation field can reuse that sequence or alternation field if the target application supports subroutine calls. A field reusing its parent field is called recursion. To ensure the recursion is finite, the field that recursively calls its parent must be optional in some way, such as having a minimum repetition of zero or being part of a list of alternatives inside the recursion.
Turn on to make this field reuse the other field’s repetition, multiplied by its own repetition.
Turn off to ignore the other field’s repetition.
This setting only makes a difference if the other field is repeated. If this field is repeated between 2 and 3 times and the other field is a pattern field that is repeated between 3 and 4 times, for example, then turning on this option will make this field match the pattern 6, 8, 9, or 12 times. Turning off this option makes this field match the other field’s pattern between 2 and 3 times.