You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/writing-rules/rule-syntax.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ The below optional fields must reside underneath a `patterns` field.
52
52
|[`metavariable-comparison`](#metavariable-comparison)|`map`| Compare metavariables against basic [Python expressions](https://docs.python.org/3/reference/expressions.html#comparisons)|
53
53
|[`pattern-not`](#pattern-not)|`string`| Logical NOT - remove findings matching this expression |
54
54
|[`pattern-not-inside`](#pattern-not-inside)|`string`| Keep findings that do not lie inside this pattern |
55
-
|[`pattern-not-regex`](#pattern-not-regex)|`string`| Filter results using a [PCRE](https://www.pcre.org/original/doc/html/pcrepattern.html)-compatible pattern in multiline mode |
55
+
|[`pattern-not-regex`](#pattern-not-regex)|`string`| Filter results using a [PCRE2](https://www.pcre.org/current/doc/html/pcre2pattern.html)-compatible pattern in multiline mode |
56
56
57
57
## Operators
58
58
@@ -152,10 +152,10 @@ This rule looks for usage of the Python standard library functions `hashlib.md5`
152
152
153
153
### `pattern-regex`
154
154
155
-
The `pattern-regex` operator searches files for substrings matching the given [PCRE](https://www.pcre.org/original/doc/html/pcrepattern.html) pattern. This is useful for migrating existing regular expression code search functionality to Semgrep. Perl-Compatible Regular Expressions (PCRE) is a full-featured regex library that is widely compatible with Perl, but also with the respective regex libraries of Python, JavaScript, Go, Ruby, and Java. Patterns are compiled in multiline mode, for example `^` and `$` matches at the beginning and end of lines respectively in addition to the beginning and end of input.
155
+
The `pattern-regex` operator searches files for substrings matching the given [PCRE2](https://www.pcre.org/current/doc/html/pcre2pattern.html) pattern. This is useful for migrating existing regular expression code search functionality to Semgrep. Perl-Compatible Regular Expressions (PCRE) is a full-featured regex library that is widely compatible with Perl, but also with the respective regex libraries of Python, JavaScript, Go, Ruby, and Java. Patterns are compiled in multiline mode, for example `^` and `$` matches at the beginning and end of lines respectively in addition to the beginning and end of input.
156
156
157
157
:::caution
158
-
PCRE supports only a [limited number of Unicode character properties](https://www.pcre.org/original/doc/html/pcrepattern.html#uniextseq). For example, `\p{Egyptian_Hieroglyphs}` is supported but `\p{Bidi_Control}` isn't.
158
+
PCRE2 supports only a [limited number of Unicode character properties](https://www.pcre.org/current/doc/html/pcre2pattern.html#uniextseq). For example, `\p{Egyptian_Hieroglyphs}` is supported but `\p{Bidi_Control}` isn't.
159
159
:::
160
160
161
161
#### Example: `pattern-regex` combined with other pattern operators
@@ -229,7 +229,7 @@ acbd
229
229
230
230
### `pattern-not-regex`
231
231
232
-
The `pattern-not-regex` operator filters results using a [PCRE](https://www.pcre.org/original/doc/html/pcrepattern.html) regular expression in multiline mode. This is most useful when combined with regular-expression only rules, providing an easy way to filter findings without having to use negative lookaheads. `pattern-not-regex` works with regular `pattern` clauses, too.
232
+
The `pattern-not-regex` operator filters results using a [PCRE2](https://www.pcre.org/current/doc/html/pcre2pattern.html) regular expression in multiline mode. This is most useful when combined with regular-expression only rules, providing an easy way to filter findings without having to use negative lookaheads. `pattern-not-regex` works with regular `pattern` clauses, too.
233
233
234
234
The syntax for this operator is the same as `pattern-regex`.
235
235
@@ -373,7 +373,7 @@ To make a list of multiple focus metavariables using set union semantics that ma
373
373
374
374
### `metavariable-regex`
375
375
376
-
The `metavariable-regex` operator searches metavariables for a [PCRE](https://www.pcre.org/original/doc/html/pcrepattern.html) regular expression. This is useful for filtering results based on a [metavariable’s](pattern-syntax.mdx#metavariables) value. It requires the `metavariable` and `regex` keys and can be combined with other pattern operators.
376
+
The `metavariable-regex` operator searches metavariables for a [PCRE2](https://www.pcre.org/current/doc/html/pcre2pattern.html) regular expression. This is useful for filtering results based on a [metavariable’s](pattern-syntax.mdx#metavariables) value. It requires the `metavariable` and `regex` keys and can be combined with other pattern operators.
0 commit comments