Commit b23060bf authored by Russell Dickenson's avatar Russell Dickenson

Merge branch 'docs-if-variables-regex' into 'master'

Update docs regarding regex in ci rules

Closes #35932

See merge request gitlab-org/gitlab!26209
parents 7b1c1eb7 5516a768
...@@ -571,9 +571,12 @@ Below you can find supported syntax reference: ...@@ -571,9 +571,12 @@ Below you can find supported syntax reference:
- `$VARIABLE =~ /^content.*/` - `$VARIABLE =~ /^content.*/`
- `$VARIABLE_1 !~ /^content.*/` (introduced in GitLab 11.11) - `$VARIABLE_1 !~ /^content.*/` (introduced in GitLab 11.11)
It is possible perform pattern matching against a variable and regular Variable pattern matching with regular expressions uses the
expression. Expression like this evaluates to truth if matches are found [RE2 regular expression syntax](https://github.com/google/re2/wiki/Syntax).
when using `=~`. It evaluates to truth if matches are not found when `!~` is used. Expressions evaluate as `true` if:
- Matches are found when using `=~`.
- Matches are *not* found when using `!~`.
Pattern matching is case-sensitive by default. Use `i` flag modifier, like Pattern matching is case-sensitive by default. Use `i` flag modifier, like
`/pattern/i` to make a pattern case-insensitive. `/pattern/i` to make a pattern case-insensitive.
......
...@@ -857,7 +857,10 @@ In this example, if the first rule: ...@@ -857,7 +857,10 @@ In this example, if the first rule:
`rules:if` differs slightly from `only:variables` by accepting only a single `rules:if` differs slightly from `only:variables` by accepting only a single
expression string, rather than an array of them. Any set of expressions to be expression string, rather than an array of them. Any set of expressions to be
evaluated should be conjoined into a single expression using `&&` or `||`. For example: evaluated should be conjoined into a single expression using `&&` or `||`, and use
the [variable matching syntax](../variables/README.md#supported-syntax).
For example:
```yaml ```yaml
job: job:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment