@@ -405,6 +405,51 @@ EXPECT_TRUE(IsCorrectPointIntVector(point_ints))
405
405
For more details regarding `AbslStringify()` and its integration with other
406
406
libraries, see go/abslstringify.
407
407
408
+ ## Regular Expression Syntax
409
+
410
+ When built with Bazel and using Abseil, GoogleTest uses the
411
+ [RE2](https://github.com/google/re2/wiki/Syntax) syntax. Otherwise, for POSIX
412
+ systems (Linux, Cygwin, Mac), GoogleTest uses the
413
+ [POSIX extended regular expression](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04)
414
+ syntax. To learn about POSIX syntax, you may want to read this
415
+ [Wikipedia entry](https://en.wikipedia.org/wiki/Regular_expression#POSIX_extended).
416
+
417
+ On Windows, GoogleTest uses its own simple regular expression implementation. It
418
+ lacks many features. For example, we don't support union (`"x|y"`), grouping
419
+ (`"(xy)"`), brackets (`"[xy]"`), and repetition count (`"x{5,7}"`), among
420
+ others. Below is what we do support (`A` denotes a literal character, period
421
+ (`.`), or a single `\\ ` escape sequence; `x` and `y` denote regular
422
+ expressions.):
423
+
424
+ Expression | Meaning
425
+ ---------- | --------------------------------------------------------------
426
+ `c` | matches any literal character `c`
427
+ `\\d` | matches any decimal digit
428
+ `\\D` | matches any character that's not a decimal digit
429
+ `\\f` | matches `\f`
430
+ `\\n` | matches `\n`
431
+ `\\r` | matches `\r`
432
+ `\\s` | matches any ASCII whitespace, including `\n`
433
+ `\\S` | matches any character that's not a whitespace
434
+ `\\t` | matches `\t`
435
+ `\\v` | matches `\v`
436
+ `\\w` | matches any letter, `_`, or decimal digit
437
+ `\\W` | matches any character that `\\w` doesn't match
438
+ `\\c` | matches any literal character `c`, which must be a punctuation
439
+ `.` | matches any single character except `\n`
440
+ `A?` | matches 0 or 1 occurrences of `A`
441
+ `A*` | matches 0 or many occurrences of `A`
442
+ `A+` | matches 1 or many occurrences of `A`
443
+ `^` | matches the beginning of a string (not that of each line)
444
+ `$` | matches the end of a string (not that of each line)
445
+ `xy` | matches `x` followed by `y`
446
+
447
+ To help you determine which capability is available on your system, GoogleTest
448
+ defines macros to govern which regular expression it is using. The macros are:
449
+ `GTEST_USES_SIMPLE_RE=1` or `GTEST_USES_POSIX_RE=1`. If you want your death
450
+ tests to work in all cases, you can either `#if` on these macros or use the more
451
+ limited syntax only.
452
+
408
453
## Death Tests
409
454
410
455
In many applications, there are assertions that can cause application failure if
@@ -509,51 +554,6 @@ TEST_F(FooDeathTest, DoesThat) {
509
554
}
510
555
```
511
556
512
- ### Regular Expression Syntax
513
-
514
- When built with Bazel and using Abseil, GoogleTest uses the
515
- [RE2](https://github.com/google/re2/wiki/Syntax) syntax. Otherwise, for POSIX
516
- systems (Linux, Cygwin, Mac), GoogleTest uses the
517
- [POSIX extended regular expression](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04)
518
- syntax. To learn about POSIX syntax, you may want to read this
519
- [Wikipedia entry](https://en.wikipedia.org/wiki/Regular_expression#POSIX_extended).
520
-
521
- On Windows, GoogleTest uses its own simple regular expression implementation. It
522
- lacks many features. For example, we don't support union (`"x|y"`), grouping
523
- (`"(xy)"`), brackets (`"[xy]"`), and repetition count (`"x{5,7}"`), among
524
- others. Below is what we do support (`A` denotes a literal character, period
525
- (`.`), or a single `\\ ` escape sequence; `x` and `y` denote regular
526
- expressions.):
527
-
528
- Expression | Meaning
529
- ---------- | --------------------------------------------------------------
530
- `c` | matches any literal character `c`
531
- `\\d` | matches any decimal digit
532
- `\\D` | matches any character that's not a decimal digit
533
- `\\f` | matches `\f`
534
- `\\n` | matches `\n`
535
- `\\r` | matches `\r`
536
- `\\s` | matches any ASCII whitespace, including `\n`
537
- `\\S` | matches any character that's not a whitespace
538
- `\\t` | matches `\t`
539
- `\\v` | matches `\v`
540
- `\\w` | matches any letter, `_`, or decimal digit
541
- `\\W` | matches any character that `\\w` doesn't match
542
- `\\c` | matches any literal character `c`, which must be a punctuation
543
- `.` | matches any single character except `\n`
544
- `A?` | matches 0 or 1 occurrences of `A`
545
- `A*` | matches 0 or many occurrences of `A`
546
- `A+` | matches 1 or many occurrences of `A`
547
- `^` | matches the beginning of a string (not that of each line)
548
- `$` | matches the end of a string (not that of each line)
549
- `xy` | matches `x` followed by `y`
550
-
551
- To help you determine which capability is available on your system, GoogleTest
552
- defines macros to govern which regular expression it is using. The macros are:
553
- `GTEST_USES_SIMPLE_RE=1` or `GTEST_USES_POSIX_RE=1`. If you want your death
554
- tests to work in all cases, you can either `#if` on these macros or use the more
555
- limited syntax only.
556
-
557
557
### How It Works
558
558
559
559
See [Death Assertions](reference/assertions.md#death) in the Assertions
0 commit comments