From 9b9dec95951472c723eb90b065e84f6f33410f12 Mon Sep 17 00:00:00 2001 From: Sebastian Poxhofer <secustor@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:58:50 +0100 Subject: [PATCH] docs(manager/regex): prefill regex101 link and fix backslash escape (#13945) * docs(manager/regex): prefill regex101 link and fix backslash escape * docs(manager/regex): fix linting --- lib/manager/regex/readme.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/manager/regex/readme.md b/lib/manager/regex/readme.md index 75becb1c6f..3d00dccf39 100644 --- a/lib/manager/regex/readme.md +++ b/lib/manager/regex/readme.md @@ -41,9 +41,10 @@ ENV YARN_VERSION=1.19.1 RUN curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} ``` -You would need to capture the `currentValue` using a named capture group, like so: `ENV YARN_VERSION=(?<currentValue>.*?)\n`. +You would need to capture the `currentValue` using a named capture group, like so: `ENV YARN_VERSION=(?<currentValue>.*?)\\n`. -If you're looking for an online regex testing tool that supports capture groups, try [https://regex101.com/](https://regex101.com/). +If you're looking for an online regex testing tool that supports capture groups, try [https://regex101.com/](<https://regex101.com/?flavor=javascript&flags=g®ex=ENV%20YARN_VERSION%3D(%3F%3CcurrentValue%3E.*%3F)%5Cn&testString=FROM%20node%3A12%0AENV%20YARN_VERSION%3D1.19.1%0ARUN%20curl%20-o-%20-L%20https%3A%2F%2Fyarnpkg.com%2Finstall.sh%20%7C%20bash%20-s%20--%20--version%20%24%7BYARN_VERSION%7D>). +Be aware that backslashes (`'\'`) of the resulting regex have to still be escaped e.g `\n\s` --> `\\n\\s`. ### Configuration templates @@ -54,7 +55,7 @@ In many cases, named capture groups alone won't be enough and you'll need to con "regexManagers": [ { "fileMatch": ["^Dockerfile$"], - "matchStrings": ["ENV YARN_VERSION=(?<currentValue>.*?)\n"], + "matchStrings": ["ENV YARN_VERSION=(?<currentValue>.*?)\\n"], "depNameTemplate": "yarn", "datasourceTemplate": "npm" } -- GitLab