需要一个reg表达 [英] need a reg expression

查看:93
本文介绍了需要一个reg表达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的.vb文件中搜索不包含下划线的行

后跟菜单。


我试过[!_]。 *菜单作为正则表达式,但我想这必须意味着

它必须包含一个不是_后跟菜单的字符。


这是正确的?


什么会起作用?


谢谢

I want to search my .vb files for lines that do not contain an underline
followed by Menu.

I tried [!_].*Menu as a regular expression but I guess that must mean that
it must contain a character that is not an _ followed by Menu.

Is that correct?

what would work?

thanks

推荐答案

2008年4月9日星期三07:38:24 -0400,AAaron123

< aa ******* @ roadrunner.comwrote:
On Wed, 9 Apr 2008 07:38:24 -0400, "AAaron123"
<aa*******@roadrunner.comwrote:

>谢谢你很高兴知道。

我现在想的是
[!_]。*菜单
意味着找到_之外的字符,然后是菜单。

我需要找到一条完全没有_的行,然后是菜单。

再次感谢
>Thanks that''s good to know.

I''m thinking now that
[!_].*Menu
means to find a character other than _ followed by Menu.

I need to find a line that has no _ at all, followed by Menu.

Thanks again



如果你的意思是_字符紧跟Menu(没有间距),

试试这个:


(?<!_)(?:菜单|)


考试科目:


123 _Menu 566

123菜单456

123 456

123_菜单456

第二和第四行匹配。其余的没有。


如果你的意思是_字符后跟菜单(包括间距),试试

这个:


(?<!_ \ s *)(?:菜单|)


第二行与测试科目相匹配。其余的没有。

If you mean the _ character immediately followed by Menu (no spacing),
try this:

(?<!_)(?:Menu|)

Test subjects:

123 _Menu 566
123 Menu 456
123 456
123_ Menu 456

Lines two and four match. The rest do not.

If you mean the _ character followed by Menu (including spacing), try
this:

(?<!_\s*)(?:Menu|)

Line two matches the test subjects. The rest do not.


2008年4月10日星期四06:33:25 -0400, ja *** @ onepost.net 写道:
On Thu, 10 Apr 2008 06:33:25 -0400, ja***@onepost.net wrote:

>如果你的意思是_字符紧跟菜单(没有间距),
(?<!_)(?:Menu |)
>If you mean the _ character immediately followed by Menu (no spacing),
try this:

(?<!_)(?:Menu|)



你可以简化这个并获得同样的结果删除最后一个

组的结果:


(?<!_)菜单


我创建了这个很快今天早上忘了删除它。

You can simplify this and get the same result by removing the last
group:

(?<!_)Menu

I created this quickly this morning and forgot to remove it.


>如果你的意思是_字符后跟Menu(包括间距),试试
这个:

(?<!_ \ * *)(?:菜单|)
>If you mean the _ character followed by Menu (including spacing), try
this:

(?<!_\s*)(?:Menu|)



这个相同:


(?<!_ \ s *)菜单

Same for this one:

(?<!_\s*)Menu


我的意思是菜单应出现,而且不应该

在它之前的任何地方都是下划线。


你在用!否定?不应该是^(请参阅Tom Shelton先前的

回复。)


非常感谢

< ; ja *** @ onepost.net写信息

news:dc **************************** **** @ 4ax.com ...
What I meant is that the word Menu should appear and that there should not
be an underscore any place before it.

Are you using ! for negation? Shouldn''t it be ^ (see Tom Shelton''s earlier
reply.)

Thanks a lot
<ja***@onepost.netwrote in message
news:dc********************************@4ax.com...

On Thu,2008年4月10日06:33:25 -0400, ja *** @ onepost.net 写道:
On Thu, 10 Apr 2008 06:33:25 -0400, ja***@onepost.net wrote:

>>如果你的意思是_字符紧随其后通过菜单(无间距),
试试这个:

(?<!_)(?:菜单|)
>>If you mean the _ character immediately followed by Menu (no spacing),
try this:

(?<!_)(?:Menu|)



你可以通过删除最后一个

组来简化这个并获得相同的结果:


(?<!_)菜单


我今天早上很快创建了这个并忘了删除它。


You can simplify this and get the same result by removing the last
group:

(?<!_)Menu

I created this quickly this morning and forgot to remove it.


>>如果你的意思是_字符后跟Menu(包括间距) ),试试这个:

(?<!_ \ * *)(?:菜单|)
>>If you mean the _ character followed by Menu (including spacing), try
this:

(?<!_\s*)(?:Menu|)



同样的:

(?<!_ \ * *)菜单


Same for this one:

(?<!_\s*)Menu



这篇关于需要一个reg表达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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