Well, I really don't think it has anything to do with your regexes; you say they are working on some cases, and since that is true, they should be working on all cases -- that is, all cases that really do match those regexes.

How closely have you looked at the content of the strings you get back from that database connection? I would suggest that there may be some extra characters in there that aren't visible if you're just using a typical console window or browser to view them. Open an output file -- and use binmode() to make sure nothing gets "interpreted" on output -- and write the offending text before and after the call to tagremover. Then look at it with any hex-mode viewer. It may be that some of those unaltered entities have "invisible" garbage characters thrown in somehow.

One other point, on a different topic:

while ($db->FetchRow()) { ... my $db2 = new Win32::ODBC($connstring) or die $!; ... }
I haven't used ODBC personally (I'm in a solaris/oracle shop), but it strikes me as wrong to be doing this connection thing on every iteration of the "while()" loop. Aren't you using the same database here as in the initial connection? Wouldn't the original connection be persistent and available for further queries/updates until you explicitly close it or exit? (I could be wrong about this, but if the repeated open is unnecessary, removing it could save you a lot of overhead.)

Good luck with the text content.


In reply to Re: Regex not matching all in DB by graff
in thread Regex not matching all in DB by Willman023

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.