We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Incorrect Regex
Incorrect Regex
Sort by
recency
|
279 Discussions
|
Please Login in order to post a comment
To avoid the EOF error we need to use try & except
Below code throws an runtime error on Pypy 2 and wrong answer in Python 3 version. Works fine on Pypy 3.
import re S = [] T = int(input()) for i in range(T): S.append(input()) for s in S: try: re.compile(s) print("True") except: print("False")
It only works with Pypy3. The same code returns "Wrong answer" with other Python versions. Probably re.compile() accepts more strings as valid regexes.
what is re funtion?