正则表达式将文件夹名称与Productivity Power Tools颜色编码进行匹配 [英] Regular Expression to match folder name with Productivity Power Tools Color Coding

查看:61
本文介绍了正则表达式将文件夹名称与Productivity Power Tools颜色编码进行匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置一个RexEx以匹配任何打开文件的文件路径的任何文件夹(父文件夹或子文件夹).因此,如果文件路径中的任何文件夹包含打开文件的名称,则将根据RegEx匹配设置选项卡的颜色编码.

例如:websiteRoot/Content/MyName1/site.css =文件打开时为绿色标签

websiteRoot/Content/MyName2/site.css =打开文件时显示橙色标签

websiste/Shared/MasterPages/MyName1/main.master =文件打开时为绿色选项卡

websiste/Shared/MasterPages/MyName2/main.master =打开文件时显示橙色标签

我尝试过:.* MyName1?$ ,但这只是查看我相信的文件名.

还尝试了.*//MyName1//?$ ,我认为如果此扩展名的Regex直接与打开的文件路径匹配,则下一个将解决问题: ^.*\\ MyName1

更有希望的正则表达式没有成功:

 <代码>.* websiteRootPath.* MyName1 | myname1 | myName1 

如果Power Productivity Tools解决了打开文件的相对路径:

 .* MyName1 | myname1 | myName1 

解决方案

您必须在

下选中"使用完整文档路径进行正则表达式匹配".

选项->生产力电动工具->高级

之后,您可以使用RegEx之类的

 <代码>.* app \\ model \\.* $.* app \\ view \\.* $.* app \\ controller \\.* $ 

I would like to configure a RexEx to match any folder (parent or child) of a file path of any open file. So if any folder in the file path contains the name of the open file, the color coding of the tab is set based on the RegEx match.

For example: websiteRoot/Content/MyName1/site.css = green colored tab when file opened

websiteRoot/Content/MyName2/site.css = orange colored tab when file opened

websiste/Shared/MasterPages/MyName1/main.master = green colored tab when file opened

websiste/Shared/MasterPages/MyName2/main.master = orange colored tab when file opened

I have tried: .*MyName1?$ but this is only looking at the file name I believe.

Also tried .*//MyName1//?$ and I thought this next one would do the trick if Regex for this extension directly matches on the open file path: ^.*\\MyName1

More promising regex with no success:

.*websiteRootPath.*MyName1|myname1|myName1

And if Power Productivity Tools works off a relative path for the open file:

.*MyName1|myname1|myName1

解决方案

You have to check "Use full document path for regular expression matching" under

Options -> Productivity Power Tools -> Advanced

After that, you can use the RegEx's like

.*app\\model\\.*$
.*app\\view\\.*$
.*app\\controller\\.*$

这篇关于正则表达式将文件夹名称与Productivity Power Tools颜色编码进行匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆