473,503 Members | 9,887 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'"><img border=0 hspace=2 src=/olaf/images/info_active.gif alt=\"Info\">Some 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 1677
rajendrapatil
2 New Member
I am writing the regex where my string contains <a href="(/AMS/get_help)" targer= "_self'"><img border=0 hspace=2 src=/olaf/images/info_active.gif alt=\"Info\">Some 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
3681
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...
2
1714
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....
2
1891
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...
4
2192
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 = " ...
4
3204
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...
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...
4
3128
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>....
1
3694
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...
3
2391
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...
1
1721
by: BHPexpert | last post by:
Regular Expression help needed -------------------------------------------------------------------------------- I want to extract all text that is contained inside the brackets after the word...
0
7207
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,...
0
7095
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...
0
7294
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,...
1
7015
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
5602
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,...
1
5026
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
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
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.