HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

What regex engine does GitLab use?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
enginewhatgitlabdoesregexuse

Problem

Let's say I have a rule like this,

- if: '$CI_COMMIT_TITLE =~ /^(fix|feat|perf|docs|build|test|ci|refactor)\S*:/'


It occurs to me that ^ does not match the start of any line in a multiline regex, only the start of the first line. That raises the question,

  • Does anything match the newline?



  • Is there a multi-line regex mode?



Where is the GitLab Regex documented? What Regex implementation do they use?

Solution

GitLab uses Ruby's core regex implementation which is Onigmo (Oniguruma-mod). I found that from looking at the source code in Ruby's regex.c.

Official documentation is mostly here: https://github.com/k-takata/Onigmo/blob/master/doc/RE

Context

StackExchange DevOps Q#15827, answer score: 1

Revisions (0)

No revisions yet.