473,407 Members | 2,314 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,407 software developers and data experts.

Testing for String inclusion

this is my questoon

$error = ' hi this is madhu babu hou r u ';
$error1 =' madhu babu';


now i want check $error1 exists in $error

there might be space between madhu & babu
Jul 31 '07 #1
4 1593
pnsreee
34
Hi madhubabu

The following code may give answer to ur question

Expand|Select|Wrap|Line Numbers
  1. if ($error =~ m/$error1/) {
  2.     print " OK \n";
  3. }
  4.  
Regards
Pnsreee
Jul 31 '07 #2
KevinADC
4,059 Expert 2GB
this is my questoon

$error = ' hi this is madhu babu hou r u ';
$error1 =' madhu babu';


now i want check $error1 exists in $error

there might be space between madhu & babu
Next time you need help with your school/course work, post the code you have written so far. pnsreee was nice enough to give you a suggestion, but in general we do not help people that have shown no effort, especially when the question is as basic as yours.

Regards,
Kevin
Jul 31 '07 #3
numberwhun
3,509 Expert Mod 2GB
Agreed! You need to post the code you have tried. Also, correct me if I am wrong kevin, but I don't think that variables will interpolate inside of a regular expression, will they? (I could be wrong as I have never though of trying)

Regards,

Jeff
Jul 31 '07 #4
KevinADC
4,059 Expert 2GB
Yes, variables will interpolate inside of "m" and on the left side (the search side) of an "s" regular expressions, but not "tr". It is very common to use a scalar as a search pattern. To get variables to interpolate on the replacement side of an "s" regexp you have to use the "e" (as in eval) modifier.
Jul 31 '07 #5

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

Similar topics

51
by: Reinhold Birkenfeld | last post by:
Hello, at the moment python-dev is discussing including Jason Orendorff's path module into the standard library. Do you have any other good and valued Python modules that you would think are...
8
by: qazmlp | last post by:
I need to include a list of - C++ headers - headers of other modules - headers of my module - implementation specific ie.OS headers In what order, they should be included in my .CPP file?...
7
by: Richard Maher | last post by:
Hi, I am seeking the help of volunteers to test some software that I've developed which facilitates distributed two-phase commit transactions, encompassing any resource manager (e.g. SQL/Server...
16
by: Nathan Funk | last post by:
I used to work as a web designer a couple of years ago, but I haven't been closely in touch in the past years. Has anything changed recently for managing content that is common among many pages...
5
by: Dave | last post by:
Hello all, To protect against multiple inclusions, it is standard practice to enclose the contents of a header file in a construct like this: #ifndef FOO_INCLUDED #define FOO_INCLUDED .......
38
by: Christoph Zwerschke | last post by:
In August 2001, there was a thread about the "Art of Unit Testing": http://groups.google.com/group/comp.lang.python/browse_frm/thread/aa2bd17e7f995d05/71a29faf0a0485d5 Paul Moore asked the...
6
by: techBoy | last post by:
I am looking for a tool that can scan my soyrce code and check if a header file gets included more then once in a sequece of compiled code. Can some one guide me to such a tool !!
72
by: Jacob | last post by:
I have compiled a set og unit testing recommendations based on my own experience on the concept. Feedback and suggestions for improvements are appreciated: ...
111
by: Tonio Cartonio | last post by:
I have to read characters from stdin and save them in a string. The problem is that I don't know how much characters will be read. Francesco -- ------------------------------------- ...
6
by: Juha Nieminen | last post by:
Multiple inclusion of the same header file can cause the compilation to fail because of multiple definitions of the same type. That's why it's standard practice to write all headers like this: ...
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: 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: 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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.