About 145,000 results
Open links in new tab
  1. 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 programs …

  2. regex - Is it worth using Python's re.compile? - Stack Overflow

    Jan 17, 2009 · In my case, using re.compile is more explicit of the purpose of regular expression, when it's value is hidden to naked eyes, thus I could get more help from Python run-time checking.

  3. What does the "r" in pythons re.compile(r' pattern flags') mean?

    Jan 14, 2014 · According to this the "r" in pythons re.compile (r ' pattern flags') refers the raw string notation : The solution is to use Python’s raw string notation for regular expression patterns; …

  4. how to do re.compile() with a list in python - Stack Overflow

    so I can then use re.search (fruit, list_of_strings) to get only the strings containing fruits, but I'm not sure how to use a list with re.compile. Any suggestions?

  5. python - Case insensitive regular expression without re.compile ...

    In Python, I can compile a regular expression to be case-insensitive using re.compile:

  6. regex - What does python's "re.compile" do? - Stack Overflow

    Dec 4, 2013 · When you run re.match for the original string and the string that was passed through re.compile, how is the latter different? What happened to the string that was passed through …

  7. How to add a variable into my re.compile expression

    11 If you're not careful, the answers above can get you into trouble. In most cases, you will want to use re.escape() to escape any possible regular expression metacharacters that appear in the string …

  8. Type of compiled regex object in python - Stack Overflow

    What is the type of the compiled regular expression in python? In particular, I want to evaluate isinstance(re.compile(''), ???) to be true, for introspection purposes. One solution I had was, h...

  9. How to fix "SyntaxWarning: invalid escape sequence" in Python?

    I use the following prompt successfully on https://duck.ai to write a script: write Python program using libcst to automatically add r to docstrings that would raise syntax warning (invalid escape sequence) …

  10. python - What's the difference between re.DOTALL and re.MULTILINE ...

    M = MULTILINE = sre_compile.SRE_FLAG_MULTILINE # make anchors look for newline S = DOTALL = sre_compile.SRE_FLAG_DOTALL # make dot match newline SRE_FLAG_MULTILINE = 8 # treat …