简体   繁体   English

如何在PyCharm中更改正则表达式的颜色

[英]How to change regex coloring in PyCharm

I know PyCharm lets you customize font coloring from the program level, in settings but I can't quite pull it off when it comes to regex. 我知道PyCharm可以让您从程序级别在设置中自定义字体颜色,但是涉及到正则表达式时我还不能完全实现。

There are lots of options for regex there but option I can't find is one that deals with backgroup color. regex有很多选项,但我找不到的选项是处理后组颜色的选项。 There is this light yellow/green color which I would like to get rid of. 我想消除这种浅黄色/绿色。 Any ideas? 有任何想法吗?

在此处输入图片说明

File->Settings->Editor->Colors & Fonts->General 文件->设置->编辑器->颜色和字体->常规

On the right side, choose "code"->"Injected language fragment" 在右侧,选择“代码”->“注入的语言片段”

You can change or remove the background color. 您可以更改或删除背景颜色。 在此处输入图片说明

The side effect is that it will also affect other syntax such as SQL in your code. 副作用是它还将影响代码中的其他语法,例如SQL。

Prefix your regexp with r : 使用r前缀您的正则表达式:

pattern = r'\d-\d-\d'

If it is not enough maybe https://plugins.jetbrains.com/plugin/2917?pr=phpStorm 如果还不够,也许https://plugins.jetbrains.com/plugin/2917?pr=phpStorm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM