From b901308874b17c6cc4c084eb9e3368a4dd5d1d75 Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Thu, 9 Mar 2023 15:44:20 +0800 Subject: [PATCH] use re.fullmatch --- doc/source/ch07_simulation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/ch07_simulation.rst b/doc/source/ch07_simulation.rst index 97a72c9..2a5ca5b 100644 --- a/doc/source/ch07_simulation.rst +++ b/doc/source/ch07_simulation.rst @@ -43,6 +43,6 @@ Naming conventions >>> r"L(?P[0-9]+)_" >>> r"(?P[A-Z0-9]+).fits" >>> ) - >>> mo = re.search(pattern, r"CSST_MSC_MS_SCI_20270626203558_20270626203828_100000066_01_L0_1.fits") + >>> mo = re.fullmatch(pattern, r"CSST_MSC_MS_SCI_20270626203558_20270626203828_100000066_01_L0_1.fits") >>> print(mo.groupdict()) {'facility': 'MSC', 'project': 'MS', 'data_type': 'SCI', 't_start': '20260612100759', 't_stop': '20260612101029', 'obs_id': '100000036', 'detector': '16', 'level': '0', 'version': '1'} -- GitLab