473,508 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to match "++" as part of regular expression

2 New Member
Hi ,

I am having a variable which has "++" or "+" as part of it .
My file consists something like this

air++
water
fire+

I want to go one by one to each line and match a particular word of that line.

By using
foreach $line (<name>) {
if($line =~ /$name/ ) {
//
}
}

This gives Nested quantifiers in regex; marked by <-- HERE in $name.

I want to know if I can do a pattern matching where my pattern consists of "++" or "+". Can anyone please help.
Oct 29 '07 #1
1 1231
KevinADC
4,059 Recognized Expert Specialist
as posted on the other forum:

Expand|Select|Wrap|Line Numbers
  1. if($line =~ /\Q$name\E/ ) {
Oct 29 '07 #2

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

Similar topics

2
9878
by: Liang | last post by:
hi, I'm a newbie to perl :-p I want to parse this kind of string: /main/abcd/efgh/hhh/3 to get the rightmost string that is enclosed in '/'. In this case, it's 'hhh'. So, how to do this in...
5
2059
by: kmunderwood | last post by:
I am trying to combine "if match=" and "when test" I am a newbie, and have made both work separately, but I can not seem to combine them. This is my xml("index.xml")page(I can not change this,...
7
1663
by: Chris Mantoulidis | last post by:
I was wondering if there was something like a "match" class in the std. By match class I mean something like a search tool. That is I will tell it in what text to search and WHAT to search for. The...
1
1227
by: myth.drannon | last post by:
Hi , I'm trying to find a simple solution to this question.. ( not just making two match parts) I have <xsl:template match=" one | two " > and then I want to test what match I have and do...
7
1377
by: charliefortune | last post by:
In order to check availability, I want to visit many different pages from a database and try and match the regular expressions 'out of stock' or 'unavailable' or 'sold out' etc. If found, the...
1
1659
by: st12iker | last post by:
Im looking for a regex expression that would enable me to match a pattern only before the first \n of a line. So for example if I had text if $\ = $$ and had text 123 DFG\n (1st line) $$ 345\n...
3
2462
by: Good Man | last post by:
Hi there Ideally, I'd like to create one javascript function and pass the file extension i'm looking for to see if its there: <input type="file" onchange="checkFile('pdf',this)" /> and then...
6
25183
matthardwick
by: matthardwick | last post by:
Is there a way to make the find box (Ctrl+F) default to match "Any part of field" instead of "Whole field". Thanks in advance. Matt.
3
1576
by: skneife | last post by:
Hi, I have an input string : <NEW>g04 8/1 0<catset>pub=g04</catset> and I use this regex expresssion to match from <NEWto </catset>, I wrote: <NEW>.+?</catsetbut it doesn't work, no match !...
0
7331
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7501
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...
1
5056
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...
0
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3204
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1564
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
424
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.