When executing the below chef inspec command getting error.
describe command ("cat sql.conf | grep 'log_filename'") do
its('stdout') {should match (/^'sql-(\d)+.log'/)}
end
Expected pattern matching is sql-20201212.log. pls check.
When executing the below chef inspec command getting error.
describe command ("cat sql.conf | grep 'log_filename'") do
its('stdout') {should match (/^'sql-(\d)+.log'/)}
end
Expected pattern matching is sql-20201212.log. pls check.
Copyright © 2021 Jogjafile Inc.
This regex
/^'sql-(\d)+.log'/doesn't match this stringsql-20201212.log. You can try it out on https://regexr.com/There are a few problems with your regex:
'is in your regex but not in your string.matches any character expect line breaks, perhaps you want to match only a dot(?), if so, then you'd need to e.g. escape it\.\din a group (())So, this regex
^sql-\d+\.log$would matchsql-20201212.logstring. I also added$to match the end of the string.