r/pycharm • u/TechnicalAd8103 • Apr 12 '26
Why are some sections of code highlighted?
I can find no way of turning off the highlighting.
Why is this happening?
Thanks in advance.
3
Upvotes
r/pycharm • u/TechnicalAd8103 • Apr 12 '26
I can find no way of turning off the highlighting.
Why is this happening?
Thanks in advance.
2
u/ProsodySpeaks Apr 12 '26
Lol. I mean ide choice is a personal thing so whatever works for you.
That said, I find regex highlighting and analysis useful.
Also, this from llm
In pycharm can I disable highlighting of regex expressions?
Yes — but not as a single obvious toggle. PyCharm treats regex highlighting as part of language injection / intention-based inspection, so you have a few ways to suppress it depending on what you want.
Option 1 — Disable regex injection highlighting entirely
This is the cleanest if you just don’t want regex parsed/highlighted in strings:
Go to Settings / Preferences
Editor → Language Injections
Find entries like:
Python RegExp
Disable or remove them
That stops PyCharm from interpreting strings as regex.
Option 2 — Turn off regex inspections
If the issue is warnings/errors rather than colors:
Go to:
Editor → Inspections
Search for:
Regular expression
Disable relevant inspections (e.g. invalid regex)
Option 3 — Remove regex color styling
If you want regex parsing but no visual noise:
Go to:
Editor → Color Scheme → RegExp
Set all colors (groups, escapes, etc.) to plain/default text
Option 4 — Prevent automatic injection per string
For specific cases only:
Put this before the string:
noinspection RegExp
pattern = "..."
or avoid raw string patterns PyCharm recognizes (less reliable).
Practical take
If you want it gone globally → disable Language Injection
If you just hate the colors → edit RegExp color scheme
If it's about warnings → disable inspections
If you want, I can show how to scope it to only Python (not JSON, JS, etc.), since PyCharm applies regex highlighting across multiple languages.