473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

checking whether string does not exist with out using !~

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.
Feb 10 '07 #1
19 8906
KevinADC
4,059 Expert 2GB
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.
Feb 10 '07 #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

!~/$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/

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.
Feb 10 '07 #3
KevinADC
4,059 Expert 2GB
still very vague, but maybe you want to use the string operator 'ne' (not equal) if you're checking an entire string.

Expand|Select|Wrap|Line Numbers
  1. if ($string ne 'this is a sentence') {
  2.    ....
  3. }
  4.  
read the book I linked you to. I am sure it will help you.
Feb 11 '07 #4
Operator =~ is fixed, it's in one of the functions that I can use only (no edit
permission), now I have to play with regular expression to make it
not equal to...

like in case 1, I want to not match char "a", I used [^a] although using =~.

Now similarly for sentence I can not used [^sentence], so I have to find out
regular expression which does this. Hope I made some sense.

Thank you,
Sateesh.
Feb 11 '07 #5
KevinADC
4,059 Expert 2GB
Why are you restricted? Is this school work?
Feb 11 '07 #6
:), If it is school work I would have opposed my teacher :).
But it's basically part of my job in oracle, where the function is in one of
the package that we are integrating with. So I can only play with regular
expression that I pass as parameter and not function.

Thank you,
Sateesh.
Feb 11 '07 #7
KevinADC
4,059 Expert 2GB
OK, well it's difficult to help with a blind-fold on. My best advice at this time is read some regexp tutorials and decide what will work within the limitations placed upon you:

http://perldoc.perl.org/perlre.html
http://perldoc.perl.org/perlretut.html
Feb 11 '07 #8
@SPABBOJU

You have to deal with a function like
Expand|Select|Wrap|Line Numbers
  1. sub fixedMatchFunc {
  2.   my($string, $pattern) = @_;
  3.  
  4.   return($string =~ m/$pattern/);
  5. }
where the operator '=~' is hard-coded.

If you want a string "not" to match, simply negate the result of the function, like this:
Expand|Select|Wrap|Line Numbers
  1. printf("positive match: %d\n", fixedMatchFunc("this is a sentence", "is a"));
  2. printf("negative match: %d\n", ! fixedMatchFunc("this is a sentence", "is a"));
@KevinADC

*****, are you so arrogant or are you unable to capture the simple problem clearly described by SPABBOJU???

You better avoid to answer, if you are destructive in a way you have exhibited yourself. I can hardly see any benefit to anyone in your answers.

Think about "who" is the blind-fold!

Greetz, Doc
Feb 12 '07 #9
KevinADC
4,059 Expert 2GB
@SPABBOJU

@KevinADC

Jesus, are you so arrogant or are you unable to capture the simple problem clearly described by SPABBOJU???

You better avoid to answer, if you are destructive in a way you have exhibited yourself. I can hardly see any benefit to anyone in your answers.

Think about "who" is the blind-fold!

Greetz, Doc
LOL.... I guess I'm just stupid, because I don't think I'm arrogant. Thanks for your, err..... thoughtful insight. ;)
Feb 12 '07 #10
KevinADC
4,059 Expert 2GB
and BTW,

I'll participate in any thread I want to, regardless of if I totally understand the question/concept or not. Until and unless you are the moderator of this forum and can dictate who particpates and who does not, keep such thoughts to yourself. I don't mind being corrected or informed of a better way or a fault in my thinking or code, in fact I appreciate it, but your condescending attitude is best left at your doorstep my friend. So stick a sock in it Doc. ;)
Feb 12 '07 #11
MMcCarthy
14,534 Expert Mod 8TB
@KevinADC

Jesus, are you so arrogant or are you unable to capture the simple problem clearly described by SPABBOJU???

You better avoid to answer, if you are destructive in a way you have exhibited yourself. I can hardly see any benefit to anyone in your answers.

Think about "who" is the blind-fold!

Greetz, Doc
Doc

Please don't abuse other experts in this way. We encourage everyone to attempt to answer questions rather than leave them unanswered. If any expert gives a wrong answer and you wish to correct it that is of course fine but please do so in a polite and respectful manner.

ADMIN
Feb 12 '07 #12
Doc

Please don't abuse other experts in this way. We encourage everyone to attempt to answer questions rather than leave them unanswered. If any expert gives a wrong answer and you wish to correct it that is of course fine but please do so in a polite and respectful manner.

ADMIN
Dear Admin!

I appreciate a culture of conversation incorporating mutual respect. No question!!!

Have you read this thrad from the beginning? I guess not. (you should!)

If experts are willing to answer questions, they should, regardless which approach they follow. But if someone blames the starter of a thread as "blind-fold" although the problem was outlined clearly, I it's hard to stand the temptation to give a hint about the way the conversation is going on. If someone marks a person who seeks for an answer as stupid, it is far away from respect to this person. Again: the question was asked clearly and was repeated subsequently and required just a simple answer (see my answer). Why calling him a "blind-fold"? Sorry, but my integrity requires to comment this, at least to give the starter of the thread the response that he is "not stupid".

So: I do NOT want to be violent, the opposite is the case. I just want to block it, whenever I recognize it.

Regards, Doc
Feb 13 '07 #13
MMcCarthy
14,534 Expert Mod 8TB
I appreciate your response doc and where you are coming from.

As an expert myself I have misread an original thread and gone off on a tangent myself so I understand how easy it is to do. In the Access forum (my area of expertise) the experts back each other up when this happens and in a friendly manner point out the error that has been made. I appreciate the fact that you thought Kevin was being rude with his "blind-fold" comment but I read that as he felt like he was working in the dark (information wise).

However, this communication difficulty arose I would be grateful in future if either yourself, Kevin or anyone else who feels an expert has answered a question inappropriately contact either myself or a forum moderator to deal with the issue. My biggest concern is that this kind of argument doesn't happen in a thread and give a bad impression to other members viewing this question.

Please feel free to contact me by PM if you would like to discuss this further. I am happy to leave the matter here.

Mary
Feb 13 '07 #14
I appreciate the fact that you thought Kevin was being rude with his "blind-fold" comment but I read that as he felt like he was working in the dark (information wise).
Well, for the sake of freedom I will take it this way.

I think my misunderstanding of the comment "blind-fold" results from the fact, that I "could see clearly" the problem described in the thread. I simply could not imagine, that someone "could not". That's possibly why I took it the wrong way, eliminating one direction of thinking, because it seemed to be impossible.

Sorry to KevinADC!

Regards, Doc
Feb 13 '07 #15
ashith
8
Can any1 help me out... wat s d CONTROL for tab in C#..Pl help me out.. Thanks
Feb 13 '07 #16
MMcCarthy
14,534 Expert Mod 8TB
Can any1 help me out... wat s d CONTROL for tab in C#..Pl help me out.. Thanks
ashith

Please post your question in a new thread.

ADMIN
Feb 13 '07 #17
KevinADC
4,059 Expert 2GB
doc,

apology accepted, but in the future please ask for clarification about any comments (like blind-fold), I or anyone else makes before jumping to conclusions and posting add hominem attacks and hyperbole. You misunderstood my comment, which I can understand, that is the nature of conversations on forums: they are easily misunderstood in the absense of body language or facial expressions or further elaborations or etc etc etc. Which is why clarification should be the first appeal, and not assumptions punctuated with irrelevant comments.

See, I thought my blind-fold comment was quite clear in meaning, but rereading the post I can see its not. It's open to interpretation. But your inerpretation was far off the mark and your response was unwarranted, even rude and condescending. There is no need for that on webdev/programming forums.

If I am clearly wrong about something, correct me, educate me, and I will return the favor when the tables are turned. If you are unsure about something I say or post, ask for clarification first.

This forum is big enough for all of us but if you find you can't tolerate me for some reason, you might consider moving on, because I plan on sticking around, imperfections and all. But I would much prefer we get along and cooperate in threads as friends, even as competitive ones, even if we are not peers as fas as programming goes, or simply ignore me if you want to. For me, life is simply too short to sweat the small stuff. Nuff said.

Regards,
Kevin
Feb 13 '07 #18
Kevin,

thanx for accepting my apology.

You are absolutely right: if someone is in doubt, he should ask for clarification, before deducing conclusions.

The real problem was: I was not in doubt!

In this sense, you agreed with my behaviour:
"If I am clearly wrong about something, correct me, educate me, ..."
SPABBOJU described his problem so clearly and even repeated it (he was punctiliously (sort of) beating you with explanational evidence), that I could really not imagine that someone could not "see" it (in my eyes the problem was outlined in a very obvious manner). For this reason, I just felt you ignored his explanations, as they were so unambiguous and coherent. But, as it has turned out, I was wrong, fortunately.

For my part: be sure in future I will attempt to interpret comments even in unconventional ways, opening new channels regarding my cognitive patterns grown so far.

I So, let's stay in harmony.

Greetz, Doc
Feb 14 '07 #19
Oops, wrong thread. Sorry!
Feb 20 '07 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: - ions | last post by:
I have created a JComboBox with its Items as a list of "M" numbers ie. M1,M2,M3.......throgh too M110 (thes are the messier objects, a catolouge of deep sky objects) the user selects of of these...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
0
by: Mike Meyer | last post by:
The recent thread on threads caused me to reread the formal definition of SCOOP, and I noticed something I hadn't really impressed me the first time around: it's using staticly checkable rules to...
14
by: Kayle | last post by:
How should we check if the '\0' characters exists in the string as I am confused that some books mentioned that we have to check whether we need to make sure that we pass the...
15
by: Geiregat Jonas | last post by:
is using if(open("file",O_EXCL) != -1){ printf("File does exists")}else{printf("file does not exists"); } a good way of checking if a file exists or not, if not how should I do it ?
0
by: Jeff | last post by:
I am trying to write some C# code that will allow me to determine if the current user running my application has "write" permissions to a particular folder. However, I can't seem to get it to...
9
by: D. Shane Fowlkes | last post by:
(ASP.NET 2 / VB) Question - How can I write a If statement to see if a control (textbox) actually exists on a page? Upon page_load, a certain control may or may not be visible on the page so I...
4
by: chinu | last post by:
HI all, i am declaring an array in javascript var a = new array(); now before assigning a value to the ith element of this array, i have to check if some value has already been assigned there....
7
by: sprash | last post by:
Newbie question: I'm trying to determine if a file physically exists regardless of the permissions on it Using File.Exists() returns false if it physically exists but the process does not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.