@@ -257,15 +257,15 @@ Examples:
257
257
{{< table caption="Examples of CEL expressions using regex library functions" >}}
258
258
| CEL Expression | Purpose |
259
259
|-------------------------------------------------------------|----------------------------------------------------------|
260
- | `"abc 123".find('[0-9]* ')` | Find the first number in a string |
261
- | `"1, 2, 3, 4".findAll('[0-9]* ').map(x, int(x)).sum() < 100` | Verify that the numbers in a string sum to less than 100 |
260
+ | `"abc 123".find('[0-9]+ ')` | Find the first number in a string |
261
+ | `"1, 2, 3, 4".findAll('[0-9]+ ').map(x, int(x)).sum() < 100` | Verify that the numbers in a string sum to less than 100 |
262
262
{{< /table >}}
263
263
-->
264
264
{{< table caption="使用正则表达式库函数的 CEL 表达式例子" >}}
265
265
| CEL 表达式 | 用途 |
266
266
| -------------------------------------------------------------| ----------------------------|
267
- | ` "abc 123".find('[0-9]* ') ` | 找到字符串中的第一个数字 |
268
- | ` "1, 2, 3, 4".findAll('[0-9]* ').map(x, int(x)).sum() < 100 ` | 验证字符串中的数字之和小于 100 |
267
+ | ` "abc 123".find('[0-9]+ ') ` | 找到字符串中的第一个数字 |
268
+ | ` "1, 2, 3, 4".findAll('[0-9]+ ').map(x, int(x)).sum() < 100 ` | 验证字符串中的数字之和小于 100 |
269
269
{{< /table >}}
270
270
271
271
<!--
@@ -476,8 +476,8 @@ Examples:
476
476
|---------------------------------------------------------------------------|-------------------------------------------------------|
477
477
| `quantity("500000G").isInteger()` | Test if conversion to integer would throw an error |
478
478
| `quantity("50k").asInteger()` | Precise conversion to integer |
479
- | `quantity("9999999999999999999999999999999999999G").asApproximateFloat()` | Lossy conversion to float |
480
- | `quantity("50k").add("20k")` | Add two quantities |
479
+ | `quantity("9999999999999999999999999999999999999G").asApproximateFloat()` | Lossy conversion to float |
480
+ | `quantity("50k").add(quantity( "20k"))` | Add two quantities |
481
481
| `quantity("50k").sub(20000)` | Subtract an integer from a quantity |
482
482
| `quantity("50k").add(20).sub(quantity("100k")).sub(-50000)` | Chain adding and subtracting integers and quantities |
483
483
| `quantity("200M").compareTo(quantity("0.2G"))` | Compare two quantities |
@@ -491,7 +491,7 @@ Examples:
491
491
| ` quantity("500000G").isInteger() ` | 测试转换为整数是否会报错 |
492
492
| ` quantity("50k").asInteger() ` | 精确转换为整数 |
493
493
| ` quantity("9999999999999999999999999999999999999G").asApproximateFloat() ` | 松散转换为浮点数 |
494
- | ` quantity("50k").add("20k") ` | 两个数量相加 |
494
+ | ` quantity("50k").add(quantity( "20k")) ` | 两个数量相加 |
495
495
| ` quantity("50k").sub(20000) ` | 从数量中减去整数 |
496
496
| ` quantity("50k").add(20).sub(quantity("100k")).sub(-50000) ` | 链式相加和减去整数和数量 |
497
497
| ` quantity("200M").compareTo(quantity("0.2G")) ` | 比较两个数量 |
0 commit comments