检查字符串是否不存在而不使用!〜 [英] checking whether string does not exist with out using !~

查看:74
本文介绍了检查字符串是否不存在而不使用!〜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好......


我想检查字符串是否不存在而不使用!〜。


基本的字符我们使用[^]进行检查。

如何为单词,句子做同样的事情?....

我实际上需要作为我的一个项目的一部分


谢谢,

Sateesh。

Hi guys...

I want to check whether string does not exist with out using !~ .

basical for character we check like that using [^ ].
How to do the same for word, sentence ?....
I actually need as a part of one of my project


Thank you,
Sateesh.

推荐答案

http://www.perl.org/books/beginning-perl/ <读取正则表达式章节。


您也可以查看index()函数,可能会做你想要的,虽然很难说,你的问题很模糊,有点令人困惑。
http://www.perl.org/books/beginning-perl/

read the regular expressions chapter.

You might also look into the index() function, might do what you want, hard to say though, your question is vague and a bit confusing.




感谢您的参考。经过那个之后,我也无法解决我的问题。


案例1)单个字母


!〜/ a /相当于=〜/ [^ a] /


案例2)总句子


!〜/
Hi,
Thanks for nice reference. After going through that one also, I could not
able to solve my problem.

case 1 ) single char

!~/a/ equivalent to =~/[^a]/

case 2) total sentence

!~/


句子/相当于?。


好​​的我的问题显然是在案例2中找到了与案例1中的等价。

框架工作中有一个函数采用正则表达式和

使用=〜进行模式匹配。


但也有一定的我想不匹配的字符串,最终

我的意思是!〜。但由于我无法在固定框架中更改功能,我希望

以这种方式更改正则表达式。


谢谢,

Sateesh。









sentence/ equivalent to ?.


Ok my problem clearly is finding equivalence in case 2 as in case 1.
There is one function in frame work which takes regular expression and
does pattern matching using =~ .

But there are also certain strings which I would like to not match, eventually
I mean !~. But as I can not change function in fixed framework I have, I want
to change regular expression in such a way.

Thank you,
Sateesh.












http://www.perl.org/books/beginning-perl/


阅读正则表达式章节。


您也可以查看index()函数,可能会做你想要的,但很难说,你的问题是模糊的,有点令人困惑。
http://www.perl.org/books/beginning-perl/

read the regular expressions chapter.

You might also look into the index() function, might do what you want, hard to say though, your question is vague and a bit confusing.


这篇关于检查字符串是否不存在而不使用!〜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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