You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python's meaning of ^ is "start of string, or in /m mode after any newline".
This is different to PCRE2's default meaning for ^, which is "start of string, or in /m mode after newlines which are not the last character in the file".
You are using PCRE2 I believe to emulate Python support? You need to set PCRE2_ALT_CIRCUMFLEX to get behaviour matching Python.
Reproduction steps
Switch Regex101 to Python mode, with r"..."gm flags
Use the regex ^$
Use the text "a<trailing newline>"
Expected Outcome
Python produces one match. Regex101 reports zero matches (same as PCRE2)
Verification:
import re
print( re.search(r"^$", "a\n", re.M) )
Browser
Include browser name and version
OS
Include OS name and version
The text was updated successfully, but these errors were encountered:
Bug Description
Python's meaning of
^
is "start of string, or in /m mode after any newline".This is different to PCRE2's default meaning for
^
, which is "start of string, or in /m mode after newlines which are not the last character in the file".You are using PCRE2 I believe to emulate Python support? You need to set PCRE2_ALT_CIRCUMFLEX to get behaviour matching Python.
Reproduction steps
r"..."gm
flags^$
Expected Outcome
Python produces one match. Regex101 reports zero matches (same as PCRE2)
Verification:
Browser
Include browser name and version
OS
Include OS name and version
The text was updated successfully, but these errors were encountered: