diff --git a/plugins/modules/nfs_exports_info.py b/plugins/modules/nfs_exports_info.py index 14de7a96a8..01e2ee7960 100644 --- a/plugins/modules/nfs_exports_info.py +++ b/plugins/modules/nfs_exports_info.py @@ -80,14 +80,14 @@ def get_exports(module, output_format, file_path="/etc/exports"): module.fail_json(msg="Could not read {}".format(file_path)) exports = {} - pattern = r'\s*(\S+)\s+(.+)' + pattern = re.compile(r'\s*(\S+)\s+(.+)') for line in output_lines: line = line.strip() if not line or line.startswith('#'): continue - match = re.match(pattern, line) + match = pattern.match(line) if not match: continue