@@ -2250,6 +2250,25 @@ public static ByteLength byteLength(String field) {
2250
2250
return new ByteLength (Field .of (field ));
2251
2251
}
2252
2252
2253
+ /**
2254
+ * Creates an expression that performs a case-sensitive wildcard string comparison.
2255
+ *
2256
+ * <p>Example:
2257
+ *
2258
+ * <pre>{@code
2259
+ * // Check if the 'title' field contains the pattern specified in field 'pattern'.
2260
+ * Function.like(Field.of("title"), Field.of("pattern"));
2261
+ * }</pre>
2262
+ *
2263
+ * @param expr The expression representing the string to perform the comparison on.
2264
+ * @param pattern The expression evaluates to the pattern to compare to.
2265
+ * @return A new {@code Expr} representing the 'like' comparison.
2266
+ */
2267
+ @ BetaApi
2268
+ public static Like like (Expr expr , Expr pattern ) {
2269
+ return new Like (expr , pattern );
2270
+ }
2271
+
2253
2272
/**
2254
2273
* Creates an expression that performs a case-sensitive wildcard string comparison.
2255
2274
*
@@ -2289,6 +2308,26 @@ public static Like like(String field, String pattern) {
2289
2308
return new Like (Field .of (field ), Constant .of (pattern ));
2290
2309
}
2291
2310
2311
+ /**
2312
+ * Creates an expression that checks if a string expression contains a specified regular
2313
+ * expression as a substring.
2314
+ *
2315
+ * <p>Example:
2316
+ *
2317
+ * <pre>{@code
2318
+ * // Check if the 'description' field contains "example" (case-insensitive)
2319
+ * Function.regexContains(Field.of("description"), Constant.of("(?i)example"));
2320
+ * }</pre>
2321
+ *
2322
+ * @param expr The expression representing the string to perform the comparison on.
2323
+ * @param pattern The expression evaluates to a regular expression string.
2324
+ * @return A new {@code Expr} representing the 'contains' comparison.
2325
+ */
2326
+ @ BetaApi
2327
+ public static RegexContains regexContains (Expr expr , Expr pattern ) {
2328
+ return new RegexContains (expr , pattern );
2329
+ }
2330
+
2292
2331
/**
2293
2332
* Creates an expression that checks if a string expression contains a specified regular
2294
2333
* expression as a substring.
@@ -2329,6 +2368,26 @@ public static RegexContains regexContains(String field, String pattern) {
2329
2368
return new RegexContains (Field .of (field ), Constant .of (pattern ));
2330
2369
}
2331
2370
2371
+ /**
2372
+ * Creates an expression that checks if a string expression matches a specified regular
2373
+ * expression.
2374
+ *
2375
+ * <p>Example:
2376
+ *
2377
+ * <pre>{@code
2378
+ * // Check if the 'email' field matches a valid email pattern
2379
+ * Function.regexMatch(Field.of("email"), Constant.of("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"));
2380
+ * }</pre>
2381
+ *
2382
+ * @param expr The expression representing the string to match against.
2383
+ * @param pattern The expression evaluates to a regular expression string.
2384
+ * @return A new {@code Expr} representing the regular expression match.
2385
+ */
2386
+ @ BetaApi
2387
+ public static RegexMatch regexMatch (Expr expr , Expr pattern ) {
2388
+ return new RegexMatch (expr , pattern );
2389
+ }
2390
+
2332
2391
/**
2333
2392
* Creates an expression that checks if a string expression matches a specified regular
2334
2393
* expression.
@@ -2368,6 +2427,25 @@ public static RegexMatch regexMatch(String field, String pattern) {
2368
2427
return new RegexMatch (Field .of (field ), Constant .of (pattern ));
2369
2428
}
2370
2429
2430
+ /**
2431
+ * Creates an expression that checks if a string expression contains a specified substring.
2432
+ *
2433
+ * <p>Example:
2434
+ *
2435
+ * <pre>{@code
2436
+ * // Check if the 'description' field contains "example".
2437
+ * Function.regexContains(Field.of("description"), Constant.of("example"));
2438
+ * }</pre>
2439
+ *
2440
+ * @param expr The expression representing the string to perform the comparison on.
2441
+ * @param substring The expression evaluates to a substring to use for the search.
2442
+ * @return A new {@code Expr} representing the 'contains' comparison.
2443
+ */
2444
+ @ BetaApi
2445
+ public static StrContains strContains (Expr expr , Expr substring ) {
2446
+ return new StrContains (expr , Constant .of (substring ));
2447
+ }
2448
+
2371
2449
/**
2372
2450
* Creates an expression that checks if a string expression contains a specified substring.
2373
2451
*
0 commit comments