Alexander  Chzhen Alexander Chzhen - 2 years ago 126
Python Question

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

Answer Source

This is known bug. For now 2017-07-27 it is still opened.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download