@@ -180,52 +180,52 @@ class RegexBuilder {
180
180
fun nonDigit (quantifier : RegexQuantifier ? = null) = append(" \\ D" , quantifier)
181
181
182
182
/* *
183
- * Add an element to match any letter in the Roman alphabet (a-z, A-Z)
183
+ * Add an element to match any Unicode letter.
184
184
*
185
185
* @param quantifier Quantifier to apply to this element
186
186
* @return The current [RegexBuilder] object, for method chaining
187
187
*/
188
- fun letter (quantifier : RegexQuantifier ? = null) = append(" [a-zA-Z] " , quantifier)
188
+ fun letter (quantifier : RegexQuantifier ? = null) = append(" \\ p{L} " , quantifier)
189
189
190
190
/* *
191
- * Add an element to match any character that is not a letter in the Roman alphabet (a-z, A-Z)
191
+ * Add an element to match any character that is not a Unicode letter.
192
192
*
193
193
* @param quantifier Quantifier to apply to this element
194
194
* @return The current [RegexBuilder] object, for method chaining
195
195
*/
196
- fun nonLetter (quantifier : RegexQuantifier ? = null) = append(" [^a-zA-Z] " , quantifier)
196
+ fun nonLetter (quantifier : RegexQuantifier ? = null) = append(" \\ P{L} " , quantifier)
197
197
198
198
/* *
199
- * Add an element to match any upper-case letter in the Roman alphabet (A-Z) .
199
+ * Add an element to match any upper-case Unicode letter .
200
200
*
201
201
* @param quantifier Quantifier to apply to this element
202
202
* @return The current [RegexBuilder] object, for method chaining
203
203
*/
204
- fun uppercaseLetter (quantifier : RegexQuantifier ? = null) = append(" [A-Z] " , quantifier)
204
+ fun uppercaseLetter (quantifier : RegexQuantifier ? = null) = append(" \\ p{Lu} " , quantifier)
205
205
206
206
/* *
207
- * Add an element to match any lowercase letter in the Roman alphabet (a-z)
207
+ * Add an element to match any lowercase Unicode letter.
208
208
*
209
209
* @param quantifier Quantifier to apply to this element
210
210
* @return The current [RegexBuilder] object, for method chaining
211
211
*/
212
- fun lowercaseLetter (quantifier : RegexQuantifier ? = null) = append(" [a-z] " , quantifier)
212
+ fun lowercaseLetter (quantifier : RegexQuantifier ? = null) = append(" \\ p{Ll} " , quantifier)
213
213
214
214
/* *
215
- * Add an element to match any letter in the Roman alphabet or decimal digit (a-z, A-Z, 0-9)
215
+ * Add an element to match any Unicode letter or decimal digit.
216
216
*
217
217
* @param quantifier Quantifier to apply to this element
218
218
* @return The current [RegexBuilder] object, for method chaining
219
219
*/
220
- fun letterOrDigit (quantifier : RegexQuantifier ? = null) = append(" [a-zA-Z0 -9]" , quantifier)
220
+ fun letterOrDigit (quantifier : RegexQuantifier ? = null) = append(" [\\ p{L}0 -9]" , quantifier)
221
221
222
222
/* *
223
- * Add an element to match any character that is not letter in the Roman alphabet or a decimal digit (a-z, A-Z, 0-9)
223
+ * Add an element to match any character that is not a Unicode letter or a decimal digit.
224
224
*
225
225
* @param quantifier Quantifier to apply to this element
226
226
* @return The current [RegexBuilder] object, for method chaining
227
227
*/
228
- fun nonLetterOrDigit (quantifier : RegexQuantifier ? = null) = append(" [^a-zA-Z0 -9]" , quantifier)
228
+ fun nonLetterOrDigit (quantifier : RegexQuantifier ? = null) = append(" [^\\ p{L}0 -9]" , quantifier)
229
229
230
230
/* *
231
231
* Add an element to match any hexadecimal digit (a-f, A-F, 0-9)
@@ -260,21 +260,20 @@ class RegexBuilder {
260
260
fun nonHexDigit (quantifier : RegexQuantifier ? = null) = append(" [^0-9A-Fa-f]" , quantifier)
261
261
262
262
/* *
263
- * Add an element to match any Roman alphabet letter, decimal digit, or underscore (a-z, A-Z, 0-9, _)
263
+ * Add an element to match any Unicode letter, decimal digit or underscore
264
264
*
265
265
* @param quantifier Quantifier to apply to this element
266
266
* @return The current [RegexBuilder] object, for method chaining
267
267
*/
268
- fun wordCharacter (quantifier : RegexQuantifier ? = null) = append(" \\ w " , quantifier)
268
+ fun wordCharacter (quantifier : RegexQuantifier ? = null) = append(" [ \\ p{L}0-9_] " , quantifier)
269
269
270
270
/* *
271
- * Add an element to match any character that is not a Roman alphabet letter, decimal digit, or underscore
272
- * (a-z, A-Z, 0-9, _)
271
+ * Add an element to match any character that is not a Unicode letter, decimal digit or underscore
273
272
*
274
273
* @param quantifier Quantifier to apply to this element
275
274
* @return The current [RegexBuilder] object, for method chaining
276
275
*/
277
- fun nonWordCharacter (quantifier : RegexQuantifier ? = null) = append(" \\ W " , quantifier)
276
+ fun nonWordCharacter (quantifier : RegexQuantifier ? = null) = append(" [^ \\ p{L}0-9_] " , quantifier)
278
277
279
278
/* *
280
279
* Add an element (a character class) to match any of the characters provided.
0 commit comments