正则表达式 [英] regex

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

问题描述

hy,


我有一个简单的问题(对于已经知道答案的人)

关于正则表达式:

我有一个像bla @ bla @ bla或bla @@ bla

i的字符串想检查@'s,但是无法弄明白如何设置零或

更多char'的。 (零或一个很容易)。


感谢'
$ b $brené

hy,

i''ve got a simple question (for somebody who already knows the answer)
about regex:
i''ve a string like bla@bla@bla or bla@@bla
i like to check the @''s, but couldn''t figure it out how to set zero or
more char''s. (zero or one was easy).

thank''s
rené

推荐答案

rene,


你确定正则表达式是最好的选择吗?为什么不

只需调用Split方法,将''''字符作为分隔符传递?

-

- Nicholas Paldino [ .NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" ohmmega" < sh **** @ gmx.atwrote in message

news:11 ********************** @ b79g2000hse.googlegr oups.com ...

hy,


我有一个简单的问题(对于已经知道答案的人)

关于正则表达式:

我有一个像bla @ bla @ bla或bla @@ bla的字符串

i喜欢检查@'s,但不能弄明白如何设置零或

更多char'。 (零或一个很容易)。


谢谢'
$ b $brené
rene,

Are you sure that a regular expression is the best option here? Why not
just call the Split method, passing the ''@'' character as the delimiter?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ohmmega" <sh****@gmx.atwrote in message
news:11**********************@b79g2000hse.googlegr oups.com...
hy,

i''ve got a simple question (for somebody who already knows the answer)
about regex:
i''ve a string like bla@bla@bla or bla@@bla
i like to check the @''s, but couldn''t figure it out how to set zero or
more char''s. (zero or one was easy).

thank''s
rené


你好ohmmega ,
Hello ohmmega,

hy,


我有一个简单的问题(对于已经知道答案的人) />
关于正则表达式:

我有一个像bla @ bla @ bla或bla @@ bla的字符串

i喜欢检查@''s ,但无法弄明白如何设置零或

更多char'。 (零或一个很容易)。

感谢'
$ b $brené
hy,

i''ve got a simple question (for somebody who already knows the answer)
about regex:
i''ve a string like bla@bla@bla or bla@@bla
i like to check the @''s, but couldn''t figure it out how to set zero or
more char''s. (zero or one was easy).
thank''s
rené



你是什么意思''我喜欢检查@'s''


从这句话的其余部分继续关于soemthing

这听起来像是一个量词这里是不同量词的简短概述

可用:

- ? - 零或一个

- * - 零或更多

- + - 一个或多个

- {0,n} - 零到n

- {n,} - n或更多

- {n,m} - n到m


选择;)


除了这是关于正则表达式的问题之外,你还没有解释

你最想要做的最终结果。正则表达式是一个相当昂贵的工具

用于cpu功率和某些场景的内存消耗。

你确定这是工作的工具吗?如果你能解释一下你想要实现的目标,我们可以帮助你找到更好的解决方案。


Jesse





我不确定你对检查是什么意思,当你<你想做什么? br />
找到一个@?


" ohmmega" < sh **** @ gmx.atwrote in message

news:11 ********************** @ b79g2000hse.googlegr oups.com ...

hy,


我有一个简单的问题(对于已经知道答案的人)

关于正则表达式:

我有一个像bla @ bla @ bla或bla @@ bla的字符串

i喜欢检查@'s,但不能弄明白如何设置零或

更多char'。 (零或一个很容易)。


感谢'
$ b $brené
Hi,

I''m not sure what you mean with "check", what do you want to do when you
find a @ ?

"ohmmega" <sh****@gmx.atwrote in message
news:11**********************@b79g2000hse.googlegr oups.com...
hy,

i''ve got a simple question (for somebody who already knows the answer)
about regex:
i''ve a string like bla@bla@bla or bla@@bla
i like to check the @''s, but couldn''t figure it out how to set zero or
more char''s. (zero or one was easy).

thank''s
rené


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

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