473,385 Members | 1,353 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,385 software developers and data experts.

regex doubt

89
Hi,
I am just a beginner exploring perl and sorry if this is a silly question.
I open a file and split by tab and check for the 11th column string as below:

I am checking whether a string contains a word chr inside a if loop as below:

Expand|Select|Wrap|Line Numbers
  1. if (($v[10] =~ m/chr/i)) {
  2.  
  3. //execute
  4. }
How to check if no chr is present in the string now. It is completely a reversed one. Thanks.
Oct 21 '08 #1
2 1178
lilly07
89
Sorry for the jiffy question. I could figure out the way. Thanks.
Expand|Select|Wrap|Line Numbers
  1. if (($v[10] !~ m/chr/i)) { 
  2.  
  3. //execute 
Oct 21 '08 #2
KevinADC
4,059 Expert 2GB
There is no need for the double set of parentheses:
Expand|Select|Wrap|Line Numbers
  1. if (($v[10] !~ m/chr/i)) { 
should be:

Expand|Select|Wrap|Line Numbers
  1. if ($v[10] !~ m/chr/i) { 
Oct 21 '08 #3

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

Similar topics

1
by: Jim Hefferon | last post by:
I am writing a class that walks through a file tree and (among other things) filters out which files it considers. So I want to have __init__( .. ,filterExpression='..') For the default I want to...
4
by: Er Galv?o Abbott | last post by:
Greetings. I have a function that does some pattern matching with JS's RegEx and I'm trying to use a variable inside of it. Nothing that I've done worked, so please help me. Here is the func:...
14
by: jumpstart | last post by:
I need a RegEx to validate INTERNATIONAL PHONE NUMBRES. Thanks, JS
8
by: Johnny | last post by:
I need to determine whether a text box contains a value that does not convert to a decimal. If the value does not convert to a decimal, I want to throw a MessageBox to have the user correct the...
3
by: Beeeeeves | last post by:
Anyone have any ideas on how fast .NET regexes are when operating on large amounts of text? (the input could be, say, 10KB of text, the regex's pattern would be fairly big ( getting on for 1KB...
8
by: jlowery | last post by:
I'm looking through the tools/scripts folder from the python install, trying to get reacquanted with the language. Got a question on the following classfix.py snippet: # This expression doesn't...
15
by: Kay Schluehr | last post by:
I have a list of strings ls = and want to create a regular expression sx from it, such that sx.match(s) yields a SRE_Match object when s starts with an s_i for one i in . There might be...
8
by: james_027 | last post by:
hi, how do I regex that could check on any of the value that match any one of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' Thanks james
2
by: John B | last post by:
I am trying to do a pretty simple pattern match using regex. The pattern is ^(?:(?<Item>.*?)@:@)*$. This should return a match for test123@:@ but does not, instead it never returns when I call...
3
by: sukatoa | last post by:
Good day Is it safe to use java regex to extract links and email addresses of a specific webpage?(this is not intended for malicious activity) We are on the final stage in college, and we have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.