Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Regex not matching all in DB

by Wonko the sane (Deacon)
on Jan 30, 2003 at 16:25 UTC ( #231366=note: print w/replies, xml ) Need Help??

in reply to Regex not matching all in DB

I agree that you are probably better off using HTML::Entities
The code you have should work for what you are trying to do.
The following snippet works as expected on your test line.
#!/usr/local/bin/perl -w use strict; my $line = q{<br>&lt;/pre&gt;<br>&lt;img src= +/analog_sc/bp/_lessons_learned/2788_1.jpg&gt;<br>&lt;br&gt;<br>&lt;im +g}; print qq{LINE:[$line]\n}; tagremover( $line ); print qq{LINE:[$line]\n}; sub tagremover { $_[0] =~ s/&lt;/</g; $_[0] =~ s/&gt;/>/g; }
LINE:[<br>&lt;/pre&gt;<br>&lt;img src= +_sc/bp/_lessons_learned/2788_1.jpg&gt;<br>&lt;br&gt;<br>&lt;img] LINE:[<br></pre><br><img src= +essons_learned/2788_1.jpg><br><br><br><img]
What are you getting in your $description var after the replacement? DOes your data have Newlines in it?


Replies are listed 'Best First'.
Re: Re: Regex not matching all in DB
by Willman023 (Scribe) on Jan 30, 2003 at 19:21 UTC
    Thanks alot guys! Its not that my regex doesn't work at all it does get some, just not when its -&gt; or <br>&lt I saw no need to escape anything in my regex the & and semicolon aren't special at all. I guess I'll try HTML::Entities as suggested instead of writing a hundred regex's.

    Perl - the breakfast of Champions!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://231366]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2022-12-04 12:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found