From e1ef9119552af2b987d15ad0e57b3328486c4658 Mon Sep 17 00:00:00 2001 From: ElaadF Date: Tue, 19 Mar 2024 12:33:13 +0100 Subject: [PATCH] Fixes #24537: Regex in file replace line must not match the string used as replacement --- tree/30_generic_methods/file_replace_lines.cf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tree/30_generic_methods/file_replace_lines.cf b/tree/30_generic_methods/file_replace_lines.cf index 4a81fa7a..68ccc980 100644 --- a/tree/30_generic_methods/file_replace_lines.cf +++ b/tree/30_generic_methods/file_replace_lines.cf @@ -29,6 +29,11 @@ # Content can be captured in regular expression, and be reused with the notation `${match.1}` (for first matched # content), `${match.2}` for second, etc, and the special captured group `${match.0}` for the whole text. # +# **This regular expression must not match the string used as a replacement.** +# For example, to set `kernel.shmmax=5678`, the regular expression would be `kernel.shmmax=(?!5678$).*` +# and the string used as remplacement `kernel.shmmax=5678` +# Note that if you want to replace a key-value line, method `File key-value present` is more suited. +# # #### Example # # Here is an example to remove enclosing specific tags