Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie: examples of regular expressions in oracle?
bbcrock_at_hotmail.com wrote:
: I found a decent enough hack on Ask Tom at oracle.
: but I don't understand when you say that you cannot reliably edit html
: using REs. I've done it for 8 years in ColdFusion and CF had a lousy
: implementation of REs for years. I'm managing a few legacy apps
: written in PERL that make massive use of REs to share data from
: webpages (think of it as proto-RSS) that have been running for 10
: years- and they're constantly working with pages that change text,
: values, tags, etc. I've never run into errors in identifying HTML tags
: in REs and can't imagine how there would be a problem since they're so
: easily identifiably and HTML ALWAYS follows the same patterns- it's the
: quintessential RE example.
HTML is not a "regular" language ("regular" being the technical term invented by various computer scientist types for a particular class of language.) Therefore a straight forward application of regular expressions cannot parse html in every situation.
And some practical cases to consider (cut/pasted from perldoc -q html.+string).
<quote>
Here are some tricky cases that you should think about when picking a solution: <IMG SRC = "foo.gif" ALT = "A > B"> <IMG SRC = "foo.gif" ALT = "A > B"> <!-- <A comment> --> <script>if (a<b && a>c)</script> <# Just data #> <![INCLUDE CDATA [ >>>>>>>>>>>> ]]> If HTML comments include other tags, those solutions would also break on text like this: <!-- This section commented out. <B>You can't see me!</B> -->
</quote>
So, if you have access to a simple to use html parser (i.e. HTML::Parser) then it is commonly worthwhile to simply use that parser instead of spending time playing with regular expressions.
-- This space not for rent.Received on Mon Mar 14 2005 - 14:03:36 CST
![]() |
![]() |