File: regex_demo.py

package info (click to toggle)
sphinx-toolbox 3.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,924 kB
  • sloc: python: 11,636; sh: 26; javascript: 25; makefile: 16
file content (13 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
# stdlib
import re

no_flags = re.compile(r"Hello\s+[Ww]orld[.,](Lovely|Horrible) weather, isn't it (.*)\?")
one_flag = re.compile(r"Hello\s+[Ww]orld[.,](Lovely|Horrible) weather, isn't it (.*)\?", flags=re.IGNORECASE)
two_flags = re.compile(
		r"Hello \s+ [Ww]orld [.,] (Lovely|Horrible)\ weather,\ isn't\ it (.*) \?",
		flags=re.ASCII | re.VERBOSE,
		)
backticks = re.compile(":py:class:`([A-Za-z_][A-Za-z0-9._]+)`")
leading_whitespace = re.compile("   :py:class:`([A-Za-z_][A-Za-z0-9._]+)`")
trailing_whitespace = re.compile(":py:class:`([A-Za-z_][A-Za-z0-9._]+)`   ")
single_whitespace = re.compile(" :py:class:`([A-Za-z_][A-Za-z0-9._]+)` ")