Repeats

Top  Previous  Next

Scripts > Productions > Repeats

 

The syntax for repeats is analogous to the according syntax for regular expressions, but the operators operate on whole tokens, productions or groups of them.

 

+

 

A token, production or group followed by the plus character '+' matches any number of occurrences of the group in the text, but at least one.

The +-operator may not be applied on nullable structures.

 

*

 

A token, production or group followed by the star character '*' matches any number of occurrences of the group in the text, including null occurrences.

 

?

 

A token, production or group followed by the question mark '?' matches an optional occurrence of the group in the text, that means null or one occurrence.

 

{}

 

You can specify the minimum and maximum number of repeats explicitly. Thus A{2} is the token or production A repeated exactly twice, A{2,4} represents A repeated between 2 and 4 times, and A{2,} represents A repeated at least twice with no upper limit. In contras to the according syntax of the regular expressions white spaces are allowed inside the {}.

 

Attention: if the minimum number of pattern isn't found in the text, there is a fault. If the pattern occurs however, the in the text more frequently than specified by the maximum number, there is a fault only when the next text pattern isn't recognized differently.

 

Remark:

The WHILE structure offers the possibility of determining the number of repeats dynamically

 



This page belongs to the TextTransformer Documentation

Home  Content  German