The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[sh] String comparison operators userix Shell Programming and Scripting 1 05-16-2008 01:09 AM
If with set operators Khoomfire UNIX for Advanced & Expert Users 2 04-25-2008 08:03 AM
bitwise operators areef4u UNIX for Advanced & Expert Users 9 08-04-2006 05:39 AM
string comparison operators, what are they?? ballazrus Shell Programming and Scripting 11 02-13-2006 03:30 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-19-2006
Registered User
 

Join Date: Aug 2005
Posts: 229
Stumble this Post!
Get Comparison operators from with RexExp

Hello all

im trying to get the Comparison operators from string with out much success
I have :
$myvar = "if (hhhh <= blah.count )" ;

when I do :
if ($myvar =~ m/.*([<=|=|<|>|>=]).*/){
…….
}
I keep getting the "=" and not "<="
why ?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-19-2006
aigles's Avatar
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,211
Stumble this Post!
Try :
Code:
if ($myvar =~ m/.*(<=|=|<|>|>=).*/){
Jean-Pierre.
Reply With Quote
  #3 (permalink)  
Old 07-19-2006
Registered User
 

Join Date: Aug 2005
Posts: 229
Stumble this Post!
Tnx for the fast reply but no... it still dont catch if i have :
$myvar = "if (hhhh <= blah.count )" ;

it finds me in the $1 "=" and not "<="
?
Reply With Quote
  #4 (permalink)  
Old 07-19-2006
Registered User
 

Join Date: Aug 2005
Posts: 229
Stumble this Post!
in the same metter

how can i recognize match of word duplication in string
for example if i have :
"blah.foo(blah.ggg)"
how can i know with regexp that i have duplication of "blah"?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0