@@ -10,6 +10,15 @@ sealed class RegexQuantifier(
10
10
11
11
interface Greedy {
12
12
val butAsFewAsPossible: RegexQuantifier
13
+
14
+ @Deprecated(
15
+ message = " Replace with butAsFewAsPossible" ,
16
+ replaceWith = ReplaceWith (
17
+ " butAsFewAsPossible" ,
18
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier"
19
+ )
20
+ )
21
+ fun butAsFewAsPossible () = butAsFewAsPossible
13
22
}
14
23
15
24
/* *
@@ -54,7 +63,7 @@ sealed class RegexQuantifier(
54
63
* @param minimum The minimum number of occurrences to match
55
64
* @return A greedy quantifier: use [butAsFewAsPossible] to make it lazy
56
65
*/
57
- class AtLeast (minimum : Int ): RegexQuantifier(" {$minimum ,}" ), Greedy {
66
+ class AtLeast (minimum : Int ) : RegexQuantifier(" {$minimum ,}" ), Greedy {
58
67
override val butAsFewAsPossible: RegexQuantifier = LazyAtLeast (minimum)
59
68
}
60
69
@@ -64,7 +73,7 @@ sealed class RegexQuantifier(
64
73
* @param maximum The maximum number of occurrences to match
65
74
* @return A greedy quantifier: use [butAsFewAsPossible] to make it lazy
66
75
*/
67
- class NoMoreThan (maximum : Int ): RegexQuantifier(" {0,$maximum }" ), Greedy {
76
+ class NoMoreThan (maximum : Int ) : RegexQuantifier(" {0,$maximum }" ), Greedy {
68
77
override val butAsFewAsPossible: RegexQuantifier = LazyNoMoreThan (maximum)
69
78
}
70
79
@@ -75,14 +84,88 @@ sealed class RegexQuantifier(
75
84
* @param maximum The maximum number of occurrences to match
76
85
* @return A greedy quantifier: use [butAsFewAsPossible] to make it lazy
77
86
*/
78
- class Between (minimum : Int , maximum : Int ): RegexQuantifier(" {$minimum ,$maximum }" ), Greedy {
87
+ class Between (minimum : Int , maximum : Int ) : RegexQuantifier(" {$minimum ,$maximum }" ), Greedy {
79
88
override val butAsFewAsPossible: RegexQuantifier = LazyBetween (minimum, maximum)
80
89
}
81
90
82
- private object LazyZeroOrMore: RegexQuantifier(" *?" )
83
- private object LazyOneOrMore: RegexQuantifier(" +?" )
84
- private object LazyZeroOrOne: RegexQuantifier(" ??" )
85
- private class LazyAtLeast (minimum : Int ): RegexQuantifier(" {$minimum ,}?" )
86
- private class LazyNoMoreThan (maximum : Int ): RegexQuantifier(" {0,$maximum }?" )
87
- private class LazyBetween (minimum : Int , maximum : Int ): RegexQuantifier(" {$minimum ,$maximum }?" )
91
+ private object LazyZeroOrMore : RegexQuantifier(" *?" )
92
+ private object LazyOneOrMore : RegexQuantifier(" +?" )
93
+ private object LazyZeroOrOne : RegexQuantifier(" ??" )
94
+ private class LazyAtLeast (minimum : Int ) : RegexQuantifier(" {$minimum ,}?" )
95
+ private class LazyNoMoreThan (maximum : Int ) : RegexQuantifier(" {0,$maximum }?" )
96
+ private class LazyBetween (minimum : Int , maximum : Int ) : RegexQuantifier(" {$minimum ,$maximum }?" )
97
+
98
+ companion object {
99
+ @Deprecated(
100
+ message = " Replace with ZeroOrOne" ,
101
+ replaceWith = ReplaceWith (
102
+ " ZeroOrOne" ,
103
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier.ZeroOrOne"
104
+ )
105
+ )
106
+ fun oneOrNone () = ZeroOrOne
107
+
108
+ @Deprecated(
109
+ message = " Replace with ZeroOrOne" ,
110
+ replaceWith = ReplaceWith (
111
+ " ZeroOrOne" ,
112
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier.ZeroOrOne"
113
+ )
114
+ )
115
+ fun zeroOrOne () = ZeroOrOne
116
+
117
+ @Deprecated(
118
+ message = " Replace with ZeroOrMore" ,
119
+ replaceWith = ReplaceWith (
120
+ " ZeroOrMore" ,
121
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier.ZeroOrMore"
122
+ )
123
+ )
124
+ fun zeroOrMore () = ZeroOrMore
125
+
126
+ @Deprecated(
127
+ message = " Replace with OneOrMore" ,
128
+ replaceWith = ReplaceWith (
129
+ " OneOrMore" ,
130
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier.OneOrMore"
131
+ )
132
+ )
133
+ fun oneOrMore () = OneOrMore
134
+
135
+ @Deprecated(
136
+ message = " Replace with Exactly" ,
137
+ replaceWith = ReplaceWith (
138
+ " Exactly(times)" ,
139
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier.Exactly"
140
+ )
141
+ )
142
+ fun exactly (times : Int ) = Exactly (times)
143
+
144
+ @Deprecated(
145
+ message = " Replace with AtLeast" ,
146
+ replaceWith = ReplaceWith (
147
+ " AtLeast(minimum)" ,
148
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier.AtLeast"
149
+ )
150
+ )
151
+ fun atLeast (minimum : Int ) = AtLeast (minimum)
152
+
153
+ @Deprecated(
154
+ message = " Replace with NoMoreThan" ,
155
+ replaceWith = ReplaceWith (
156
+ " NoMoreThan(maximum)" ,
157
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier.NoMoreThan"
158
+ )
159
+ )
160
+ fun noMoreThan (maximum : Int ) = NoMoreThan (maximum)
161
+
162
+ @Deprecated(
163
+ message = " Replace with Between" ,
164
+ replaceWith = ReplaceWith (
165
+ " Between(minimum, maximum)" ,
166
+ " uk.co.mainwave.regextoolboxkotlin.RegexQuantifier.Between"
167
+ )
168
+ )
169
+ fun between (minimum : Int , maximum : Int ) = Between (minimum, maximum)
170
+ }
88
171
}
0 commit comments