473,668 Members | 2,632 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 1237
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
9888
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 Perl? something as '=~ /\/(.*)\//' ?
5
2069
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, it comes to me this way. <?xml version="1.0" encoding="iso-8859-1" ?>
7
1678
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 format of what I want it to find would be something like: "abc?efg*mnopq?st*z" I hope you understand what I mean. :) So it a class (or anyway SOMETHING) in the std header files that is something like that or do I have to implement it myself?
1
1233
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 something accordinly. I was thinking <xsl:if test="match=one" > will work but it's not ....
7
1382
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 product will be flagged as unavailable. I tried using fopen() and preg_match() but the problem is, if the reg. expression is present in javascript or in comments, the item gets wrongly flagged. Is there a way of taking what appears on the users...
1
1663
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 3678 DSGDFG\n 678TY&^*\n (all 2nd line because of $\ = $$) $$
3
2474
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 have the function something like (w/ Prototype)
6
25218
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
1584
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 ! What is the good way ? Thanks. Sam
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8367
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8790
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8650
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6206
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.