About 8,170,000 results
Open links in new tab
  1. What is the difference between re.search and re.match?

    Oct 8, 2008 · What is the difference between the search () and match () functions in the Python re module? I've read the Python 2 documentation (Python 3 documentation), but I never seem to …

  2. How can I find all matches to a regular expression in Python?

    Jan 17, 2024 · 562 When I use the re.search() function to find matches in a block of text, the program exits once it finds the first match in the block of text. How do I do this repeatedly …

  3. python - Regular Expressions: Search in list - Stack Overflow

    Sep 4, 2010 · I want to filter strings in a list based on a regular expression. Is there something better than [x for x in list if r.match(x)] ?

  4. Python regular expressions return true/false - Stack Overflow

    Jul 4, 2011 · Python offers two different primitive operations based on regular expressions: re.match() checks for a match only at the beginning of the string, while re.search() checks for a …

  5. python - What's the difference between re.DOTALL and …

    When matching an expression on multiple lines, I always used re.DOTALL and it worked OK. Now I stumbled across the re.MULTILINE string, and it looks like it's doing the same thing. From …

  6. Python: How to use RegEx in an if statement? - Stack Overflow

    I have the following code which looks through the files in one directory and copies files that contain a certain string into another directory, but I am trying to use Regular Expressions as …

  7. python - Regular expression to match a dot - Stack Overflow

    Dec 21, 2012 · A . in regex is a metacharacter, it is used to match any character. To match a literal dot in a raw Python string (r"" or r''), you need to escape it, so r"\."

  8. How to replace only part of the match with python re.sub

    How to replace only part of the match with python re.sub Asked 15 years, 7 months ago Modified 4 months ago Viewed 116k times

  9. python - When to use re.compile - Stack Overflow

    Dec 13, 2018 · Here's a note straight out of the re docs: Note The compiled versions of the most recent patterns passed to re.compile() and the module-level matching functions are cached, so …

  10. Get the string within brackets in Python - Stack Overflow

    Edit: The regular expression here is a python raw string literal, which basically means the backslashes are not treated as special characters and are passed through to the re.search() …