Skip to content

Commit 9cfa30b

Browse files
authored
Merge pull request #457 from tja523/fix-section-regex
match section names containing prefix character (normally [)
2 parents 2c1406f + de6dc5f commit 9cfa30b

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

lib/puppet/util/ini_file.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,9 @@ def initialize(path, key_val_separator = ' = ', section_prefix = '[', section_su
3131

3232
def section_regex
3333
# Only put in prefix/suffix if they exist
34-
# Also, if the prefix is '', the negated
35-
# set match should be a match all instead.
3634
r_string = '^\s*'
3735
r_string += Regexp.escape(@section_prefix)
38-
r_string += '('
39-
if @section_prefix != ''
40-
r_string += '[^'
41-
r_string += Regexp.escape(@section_prefix)
42-
r_string += ']'
43-
else
44-
r_string += '.'
45-
end
46-
r_string += '*)'
36+
r_string += '(.*)'
4737
r_string += Regexp.escape(@section_suffix)
4838
r_string += '\s*$'
4939
%r{#{r_string}}

0 commit comments

Comments
 (0)