473,659 Members | 2,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help needed :- Regular expression

5 New Member
I am writing the regex where my string contains <a href="(/AMS/get_help)" targer= "_self'"><i mg border=0 hspace=2 src=/olaf/images/info_active.gif alt=\"Info\">So me Text</a>
here i am intially removing <img> tag.

as $str =~s/<img.*?>//g;
and it removes the img tag.
But when i try to remove the <a href.*?>as
$str =~s/<a href.*?>//g;
it is not being removed
and I have tried with printing value of $1 as
$str =~m/<a href(.*?)>/;
its not prining anything.

can anyone please help me regarding this,

Thnaks in Advance,

Sneha
Dec 8 '06 #1
2 1684
rajendrapatil
2 New Member
I am writing the regex where my string contains <a href="(/AMS/get_help)" targer= "_self'"><i mg border=0 hspace=2 src=/olaf/images/info_active.gif alt=\"Info\">So me Text</a>
here i am intially removing <img> tag.

as $str =~s/<img.*?>//g;
and it removes the img tag.
But when i try to remove the <a href.*?>as
$str =~s/<a href.*?>//g;
it is not being removed
and I have tried with printing value of $1 as
$str =~m/<a href(.*?)>/;
its not prining anything.

can anyone please help me regarding this,

Thnaks in Advance,

Sneha
Dear Snehal i dont feel any thing wrong in your code it is perfactly correct
please check it once again i check it on my machine and it working properly
Dec 8 '06 #2
GunnarH
83 New Member
To deal with the immediate problem, I would guess that you need the /s modifier. You should also study the applicable Perl FAQ, i.e. perldoc -q "remove HTML".
Dec 8 '06 #3

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

Similar topics

9
3690
by: Steve | last post by:
Hello, I am writing a script that calls a URL and reads the resulting HTML into a function that strips out everthing and returns ONLY the links, this is so that I can build a link index of various pages. I have been programming in PHP for over 2 years now and have never encountered a problem like the one I am having now. To me this seems like it should be just about the simplest thing in the world, but I must admit I'm stumped BIG TIME!...
2
1720
by: Jack Smith | last post by:
Can someone help me out with this problem. Any help is appreciated. Thanks. Let doubleswap(x) be the string formed by replacing each a in x by the substring bb and each b by the substring aa. For example, doubleswap(abcab)=bbaacbbaa. Furthermore, let doubleswap(L) be the language formed of strings doubleswap(x) for x an element of L. Prove that if L is regular, then so is doubleswap(L). Where L is a subset (or equal) to {a, b, c}^*.
2
1899
by: Jack Smith | last post by:
I posted this question earlier, but I got no responses. Can anyone help me out here...any hints or even how to start? Thanks in advance. Let doubleswap(x) be the string formed by replacing each a in x by the substring bb and each b by the substring aa. For example, doubleswap(abcab)=bbaacbbaa. Furthermore, let doubleswap(L) be the language formed of strings doubleswap(x) for x an element of L. Prove that if L is regular, then so is...
4
2204
by: pekka niiranen | last post by:
Hi there, I have perl script that uses dynamically constructed regular in this way: ------perl code starts ---- $result ""; $key = AAA\?01; $key = quotemeta $key; $line = " s^\?AAA\?01^BBB^g; #Comment "
4
3220
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go over each document, find out if it contains a header and/or a footer and extract only the main content part. The headers and the footers have no specific format and I have to detect and remove them using a list of strings that may appear as...
5
477
by: tmeister | last post by:
I am in need of a regular expression that tests and fails if there are 14 or more of a character in the test string. There can be up to 13 of these characters in the string and any other characters, but at the 14th of this character it should fail. Thanks, Todd Meister
4
3143
by: henrik | last post by:
Hi I have a regex question. I want to find all content of a <td class="someclass"> tag. This means the expression should include all other tags included between <td class="someclass"> and </td>. Please help Regards
1
3705
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am online. Plz....Plz..Plz...
3
2409
by: Willing 2 Learn | last post by:
Hey, I'm trying to teach myself C++ and I came across 3 problems. I understand the concept of FSA but getting the C++ code to do it as become an issue. Only thing is im clueless as to how to do them; these are: 1) Devise a coding system to send CAPITAL LETTERS using the ASCII code. Assume the lights will be ON when you start sending, and use OFF for ZERO and ON for ONE. 2. I want to use this code to send letters to someone else by...
1
1736
by: BHPexpert | last post by:
Regular Expression help needed -------------------------------------------------------------------------------- I want to extract all text that is contained inside the brackets after the word INDIRECT. There must be at least one pair of parentheses, they may be multiple pairs for exampple, this string '=IF($B$9="Off",0,INDIRECT(ADDRESS(1(8),COLUMNS($A$41:C41),,,$B$9 )),()aaaa' has four bracket pairings until the initial "(" is...
0
8427
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
8746
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
8525
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
7356
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
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
5649
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();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
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 we have to send another system
2
1737
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.