| 
       Repeats  | 
    Top Previous Next | 
| 
 Scripts > Token definitions > Regular expressions > Repeats 
 Any atom (a single character, a marked sub-expression, or a character class) can be repeated with the *, +, ?, and {} operators. 
 * 
 The * operator will match the preceding atom zero or more times, for example the expression a*b will match any of the following: 
 b ab aaaaaaaab 
 + 
 The + operator will match the preceding atom one or more times, for example the expression a+b will match any of the following: 
 ab aaaaaaaab 
 But will not match: 
 b 
 
 ? 
 The ? operator will match the preceding atom zero or one times, for example the expression ca?b will match any of the following: 
 cb cab 
 But will not match: 
 caab 
 {} 
 An atom can also be repeated with a bounded repeat: 
 a{n} Matches 'a' repeated exactly n times. 
 a{n,} Matches 'a' repeated n or more times. 
 a{n, m} Matches 'a' repeated between n and m times inclusive. 
 For example: 
 ^a{2,3}$ 
 Will match either of: 
 aa aaa 
 But neither of: 
 a aaaa 
 It is an error to use a repeat operator, if the preceding construct can not be repeated, for example: 
 a(*) 
 Will raise an error, as there is nothing for the * operator to be applied to. 
 All repeat expressions refer to the shortest possible previous sub-expression: a single character; a character set, or a sub-expression grouped with "()" for example. The expression "ba*" doesn't match "baba". 
 
  | 
| 
       This page belongs to the TextTransformer Documentation  | 
    Home Content German |