Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm thinks this RegExp has Duplicate character is characte class. Is it bug or not?

# Python3
r = re.compile(r"[\U0001f570\U0001f573\U0001f57a]")

This RegExp should find one of three emoji. Everything works correct, but PyCharm says:

"Duplicate character \U0001f573 inside character class"

"Duplicate character \U0001f57a inside character class"

If I change order, it says the same about 2nd and 3rd symbols, but never says about 1st one.

Is it a bug in PyCharm (maybe about about unicode surrogate pairs) or there is really something wrong with my RegExp?

UPDATE: Screenshot to be sure you get me right. enter image description here

like image 814
Alexander C Avatar asked Oct 17 '22 12:10

Alexander C


2 Answers

This was known bug. It was closed in 2020-09.

like image 166
Alexander C Avatar answered Oct 21 '22 03:10

Alexander C


ran your code in my pycharm didn't get any errors:

PyCharm 2017.1 Build #PY-171.3780.115, built on March 24, 2017

JRE: 1.8.0_112-release-736-b13 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.4.0-75-generic

try updating the ide

like image 43
Mani Shirvani Avatar answered Oct 21 '22 03:10

Mani Shirvani