my  preference for a task like this is to use xpath and treat html as
xml. if it's not xhtml then i would use jtidy to clean it up so it is.

then it's trivial to select all text nodes that are children of html,
your code is more self-documenting and easier to mantain.

i've written a super simple tag:

<cf_tidy input="html" output="xhtmlVar" />
<cfset nodes = XmlFind(xhtmlVar, "xpathExp") />



Charlie Arehart wrote:
> In the spirit of "teaching a man to fish", should anyone trip over RegEx
> problems in the future, here are a few resources to help with regular
> expressions.
>
>
>
> First, good ol' Ben Forta came out with a slim little book to help teach
> RegEx's, in "Teach Yourself Regular Expressions in 10 Minutes". It's
> available at Amazon at http://www.amazon.com/gp/product/0672325667/.
>
>
>
> Second, there are various tools to help you build RegEx's interactively,
> including
>
>
>
> http://weitz.de/regex-coach/
>
> http://www.regular-expressions.info/regexbuddy.html
>
>
>
> and still more listed at places like:
>
>
>
> http://www.larkware.com/RegexTools.html
>
> http://www.regular-expressions.info/
>
>
>
> Still another useful tool, which is helpful when one is searching for files
> having content (or names) matching a given regex, is a free (Windows) tool
> called Agent Ransack (http://www.agentransack.com
> <http://www.agentransack.com/> ). It's a freeware version of a commercial
> tool called File Locator Pro. I've blogged more details about it before:
>
>
>
> http://www.tipicalcharlie.com/a_better_file_findsearch_tool_on_windows.htm
>
>
>
> But even beyond using it for finding files, I sometimes call it up even when
> I'm not interested in building the RegEx for use in that tool just because I
> like its regular expression builder.
>
>
>
> Finally, for those who may wonder why one would care to learn about them,
> regular expressions can be used in many places, including such file finding
> tools, and in editors-including Dreamweaver MX, CF Studio, HomeSite+, and
> CFEclipse), and in CFML itself, in functions like REFind() and REReplace().
>
>
>
> /Charlie
>
>
>
>   _____
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
> Of Taco Fleur
> Sent: Thursday, April 13, 2006 5:44 PM
> To: [email protected]
> Subject: [cfaussie] Re: RegEx brain fart
>
>
>
> thanks for the help guys, it works pretty smooth now.
>
> On 4/13/06, Tom Kerr <[EMAIL PROTECTED]> wrote:
>
>
> Hrm, don't have a current CF installation to test this against, but
> converting it to sed syntax worked.  It should not perform replacements
> on partial tag matches (as per your sometag example below).  I believe
> in CF you'd want:
>
> reReplaceNoCase( variables.htmlHighlightedContent,
>        "(>[^<]*)(#variables.item#)([^<]*<)",
>        "\1<span class='keyword'>\2</span>\3", "all" )
>
> I believe that the example that you said was ok, the one you were
> complaining was too slow in a seperate response, will only perform the
> replacement on the last matching case of the keyword in the string,
> rather than all of them as you seem to require.  This is (as Blair
> mentioned in his reply) because of the greedy matching nature of the .*
> construct.  Anybody able to confirm these two points?
>
> Most regex implementations have modifiers to produce a lazy .* match,
> and I assume CF has the same but no idea what the syntax is.  In general
> I find that they complicate your expression more often than they
> simplify it anyway.
>
> cheers,
>
> -T
>
> On Thu, Apr 13, 2006 at 04:09:59PM +1000, Taco Fleur wrote:
> > this one produces output like
> >
> > Visual Basic/span>
> >
> > lets not forget that the word could also be part of a tag, i.e.
> >
> > <sometag> and the word searched for is "tag"
> >
> >
> > On 4/13/06, Tom Kerr <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > I believe that should have been ">[^<]*(#variables.item#)[^<]*<".  It
> > > might also break if it's possible for variables.item to contain the '<'
> > > character.
> > >
> > > HTH.
> > >
> > > -T
> > >
> > > On Thu, Apr 13, 2006 at 02:16:16PM +1000, Taco Fleur wrote:
> > > > Almost,
> > > > it created the following output, which is a bit of a mess:
> > > >
> > > > <span style='font-family:Arial;mso-bidi-font-family:
> > > >   "Times New Roman"'<span class='keyword'>PHP</span>>
> > > >
> > > >
> > > > On 4/13/06, Blair McKenzie <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > If you left the body tags around the content (or div or something)
> > > this
> > > > > regex should only select keywords that are outside of a tag's <>.
> > > > > ">[^<]*(#variables.item#)[^>]*<"
> > > > >
> > > > > So: Select the keyword if there is no tag opening char between it
> and
> > > the
> > > > > last tag close, and there is no tag closing char between it and the
> > > next tag
> > > > > open.
> > > > >
> > > > >
> > > > >
> > > > > On 4/13/06, Taco Fleur <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > >  To split up the html
> > > > > >
> > > > > > variables.result = reFindNoCase( "<body[^>]+>(.+)</body>",
> > > > > > variables.htmlContent, 1, true );
> > > > > > variables.htmlContentHeader = left( variables.htmlContent,
> > > result.pos[ 2
> > > > > > ] );
> > > > > > variables.htmlContentBody = mid( variables.htmlContent,
> result.pos[
> > > 2 ],
> > > > > > result.len[ 2 ] );
> > > > > > variables.htmlContentFooter = right( variables.htmlContent, ( len(
> > > > > > variables.htmlContent ) +1 ) - ( result.pos[ 2 ] + result.len[ 2 ]
> > > ));
> > > > > >
> > > > > > To highlight the keyword
> > > > > >
> > > > > > <cfset variables.htmlHighlightedContent = reReplaceNoCase(
> > > > > > variables.htmlHighlightedContent, "(#variables.item#)", "<span
> > > > > > class='keyword'>\1</span>", "all" ) />
> > > > > >
> > > > > >
> > > > > >  On 4/13/06, Blair McKenzie <[EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > What are you using at the moment?
> > > > > > >
> > > > > > >
> > > > > > > On 4/13/06, Taco Fleur <[EMAIL PROTECTED] > wrote:
> > > > > > > >
> > > > > > > >  I'm drawing a blank on coming up with a regex for the
> > > following;
> > > > > > > >
> > > > > > > > I have some HTML that I read in a variable, then I highlight
> the
> > > > > > > > keywords with a regex, which is fine, but some keywords might
> be
> > > contained
> > > > > > > > within a tag, for example <html><strong> etc, I don't want to
> > > highlight
> > > > > > > > those, what would the regex need to look like, anyone any idea
> > > on this one?
> > > > > > > >
> > > > > > > > thanks.
> > > > > > > >
> > > > > > > > --
> > > > > > > > Taco Fleur - http://www.pacificfox.com.au
> > > > > > > > Web Design, Web development, Graphic Design and Complete
> > > Internet
> > > > > > > > Solutions
> > > > > > > > an industry leader with commercial IT experience since 1994 ?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > an industry leader with commercial IT experience since 1994 ?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Taco Fleur - http://www.pacificfox.com.au
> > > > Web Design, Web development, Graphic Design and Complete Internet
> > > Solutions
> > > > an industry leader with commercial IT experience since 1994 ?
> > > >
> > > >
> > > >
> > >
> > > >
> > >
> >
> >
> > --
> > Taco Fleur - http://www.pacificfox.com.au
> > Web Design, Web development, Graphic Design and Complete Internet
> Solutions
> > an industry leader with commercial IT experience since 1994 ?
> >
> >
> >
>
>
> --
> Taco Fleur - http://www.pacificfox.com.au
> Web Design, Web development, Graphic Design and Complete Internet Solutions
> an industry leader with commercial IT experience since 1994 .
>
>
> ------=_NextPart_000_005F_01C65FF2.93B89630
> Content-Type: text/html; charset=utf-8
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 17410
>
> <html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
> osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
> xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" xmlns=3D"http://ww=
> w.w3.org/TR/REC-html40">
>
> <head>
> <meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
> <meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
> <!--[if !mso]>
> <style>
> v\:* {behavior:url(#default#VML);}
> o\:* {behavior:url(#default#VML);}
> w\:* {behavior:url(#default#VML);}
> =2Eshape {behavior:url(#default#VML);}
> </style>
> <![endif]--><o:SmartTagType
>  namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"Person=
> Name"/>
> <!--[if !mso]>
> <style>
> st1\:*{behavior:url(#default#ieooui) }
> </style>
> <![endif]-->
> <style>
> <!--
>  /* Font Definitions */
>  @font-face
>       {font-family:Tahoma;
>       panose-1:2 11 6 4 3 5 4 4 2 4;}
>  /* Style Definitions */
>  p.MsoNormal, li.MsoNormal, div.MsoNormal
>       {margin:0in;
>       margin-bottom:.0001pt;
>       font-size:12.0pt;
>       font-family:"Times New Roman";}
> a:link, span.MsoHyperlink
>       {color:blue;
>       text-decoration:underline;}
> a:visited, span.MsoHyperlinkFollowed
>       {color:blue;
>       text-decoration:underline;}
> span.EmailStyle18
>       {mso-style-type:personal-reply;
>       font-family:Arial;
>       color:navy;}
> @page Section1
>       {size:8.5in 11.0in;
>       margin:1.0in 1.25in 1.0in 1.25in;}
> div.Section1
>       {page:Section1;}
> -->
> </style>
>
> </head>
>
> <body lang=3DEN-US link=3Dblue vlink=3Dblue>
>
> <div class=3DSection1>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'>In the spirit of &#8220;teaching a man=
>  to
> fish&#8221;, should anyone trip over RegEx problems in the future, here are=
>  a
> few resources to help with regular expressions. <o:p></o:p></span></font></=
> p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'>First, good ol&#8217; Ben Forta came o=
> ut with
> a slim little book to help teach RegEx&#8217;s, in &#8220;Teach Yourself
> Regular Expressions in 10 Minutes&#8221;. It&#8217;s available at Amazon at=
>  <a
> href=3D"http://www.amazon.com/gp/product/0672325667/";>http://www.amazon.com=
> /gp/product/0672325667/</a>.<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'>Second, there are various tools to help
> you build RegEx&#8217;s interactively, including <o:p></o:p></span></font><=
> /p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><a href=3D"http://weitz.de/regex-coach=
> /">http://weitz.de/regex-coach/</a><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><a
> href=3D"http://www.regular-expressions.info/regexbuddy.html";>http://www.reg=
> ular-expressions.info/regexbuddy.html</a><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'>and still more listed at places like:<=
> o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><a
> href=3D"http://www.larkware.com/RegexTools.html";>http://www.larkware.com/Re=
> gexTools.html</a><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><a
> href=3D"http://www.regular-expressions.info/";>http://www.regular-expression=
> s.info/</a><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'>Still another useful tool, which is
> helpful when one is searching for files having content (or names) matching a
> given regex, is a free (Windows) tool called Agent Ransack (<a
> href=3D"http://www.agentransack.com/";>http://www.agentransack.com</a>). It&=
> #8217;s
> a freeware version of a commercial tool called File Locator Pro. I&#8217;ve=
>  blogged
> more details about it before:<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><a
> href=3D"http://www.tipicalcharlie.com/a_better_file_findsearch_tool_on_wind=
> ows.htm">http://www.tipicalcharlie.com/a_better_file_findsearch_tool_on_win=
> dows.htm</a><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'>But even beyond using it for finding f=
> iles,
> I sometimes call it up even when I&#8217;m not interested in building the R=
> egEx
> for use in that tool just because I like its regular expression builder.<o:=
> p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'>Finally, for those who may wonder why =
> one
> would care to learn about them, regular expressions can be used in many pla=
> ces,
> including such file finding tools, and in editors&#8212;including Dreamweav=
> er
> MX, CF Studio, HomeSite+, and CFEclipse), and in CFML itself, in functions =
> like
> REFind() and REReplace().<o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>
>
> <div>
>
> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span 
> style=3D'font-size:
> 10.0pt;font-family:Arial;color:navy'>/Charlie</span></font><font color=3Dna=
> vy><span
> style=3D'color:navy'><o:p></o:p></span></font></p>
>
> <p class=3DMsoNormal><font size=3D3 color=3Dnavy face=3D"Times New Roman"><=
> span
> style=3D'font-size:12.0pt;color:navy'>&nbsp;</span></font><o:p></o:p></p>
>
> </div>
>
> <div>
>
> <div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font siz=
> e=3D3
> face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>
>
> <hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1>
>
> </span></font></div>
>
> <p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span style=3D'font-si=
> ze:10.0pt;
> font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=3D2
> face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'> <st1:Per=
> sonName
> w:st=3D"on">[email protected]</st1:PersonName> [mailto:<st1:PersonN=
> ame
> w:st=3D"on">[email protected]</st1:PersonName>] <b><span
> style=3D'font-weight:bold'>On Behalf Of </span></b>Taco Fleur<br>
> <b><span style=3D'font-weight:bold'>Sent:</span></b> Thursday, April 13, 20=
> 06
> 5:44 PM<br>
> <b><span style=3D'font-weight:bold'>To:</span></b> <st1:PersonName w:st=3D"=
> on">[email protected]</st1:PersonName><br>
> <b><span style=3D'font-weight:bold'>Subject:</span></b> [cfaussie] Re: RegEx
> brain fart</span></font><o:p></o:p></p>
>
> </div>
>
> <p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span style=3D=
> 'font-size:
> 12.0pt'><o:p>&nbsp;</o:p></span></font></p>
>
> <p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><font size=3D3
> face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>thanks for the he=
> lp guys,
> it works pretty smooth now.<o:p></o:p></span></font></p>
>
> <div>
>
> <p class=3DMsoNormal><span class=3Dgmailquote><font size=3D3 face=3D"Times =
> New Roman"><span
> style=3D'font-size:12.0pt'>On 4/13/06, <b><span style=3D'font-weight:bold'>=
> Tom Kerr</span></b>
> &lt;<a href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>&gt; =
> wrote:</span></font></span>
> <o:p></o:p></p>
>
> <p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><font size=3D3
> face=3D"Times New Roman"><span style=3D'font-size:12.0pt'><br>
> Hrm, don't have a current CF installation to test this against, but<br>
> converting it to sed syntax worked.&nbsp;&nbsp;It should not perform
> replacements <br>
> on partial tag matches (as per your sometag example below).&nbsp;&nbsp;I
> believe<br>
> in CF you'd want:<br>
> <br>
> reReplaceNoCase( variables.htmlHighlightedContent,<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;(&gt;[^&lt;]*)(#variables.item#)=
> ([^&lt;]*&lt;)&quot;,
> <br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\1&lt;span
> class=3D'keyword'&gt;\2&lt;/span&gt;\3&quot;, &quot;all&quot; )<br>
> <br>
> I believe that the example that you said was ok, the one you were<br>
> complaining was too slow in a seperate response, will only perform the <br>
> replacement on the last matching case of the keyword in the string,<br>
> rather than all of them as you seem to require.&nbsp;&nbsp;This is (as Blai=
> r<br>
> mentioned in his reply) because of the greedy matching nature of the .*<br>
> construct.&nbsp;&nbsp;Anybody able to confirm these two points? <br>
> <br>
> Most regex implementations have modifiers to produce a lazy .* match,<br>
> and I assume CF has the same but no idea what the syntax is.&nbsp;&nbsp;In
> general<br>
> I find that they complicate your expression more often than they <br>
> simplify it anyway.<br>
> <br>
> cheers,<br>
> <br>
> -T<br>
> <br>
> On Thu, Apr 13, 2006 at 04:09:59PM +1000, Taco Fleur wrote:<br>
> &gt; this one produces output like<br>
> &gt;<br>
> &gt; Visual Basic/span&gt;<br>
> &gt;<br>
> &gt; lets not forget that the word could also be part of a tag, i.e.<br>
> &gt;<br>
> &gt; &lt;sometag&gt; and the word searched for is &quot;tag&quot;<br>
> &gt;<br>
> &gt;<br>
> &gt; On 4/13/06, Tom Kerr &lt;<a href=3D"mailto:[EMAIL PROTECTED]">tjke=
> [EMAIL PROTECTED]</a>&gt;
> wrote:<br>
> &gt; &gt;<br>
> &gt; &gt;<br>
> &gt; &gt; I believe that should have been
> &quot;&gt;[^&lt;]*(#variables.item#)[^&lt;]*&lt;&quot;.&nbsp;&nbsp;It<br>
> &gt; &gt; might also break if it's possible for variables.item to contain t=
> he
> '&lt;'<br>
> &gt; &gt; character. <br>
> &gt; &gt;<br>
> &gt; &gt; HTH.<br>
> &gt; &gt;<br>
> &gt; &gt; -T<br>
> &gt; &gt;<br>
> &gt; &gt; On Thu, Apr 13, 2006 at 02:16:16PM +1000, Taco Fleur wrote:<br>
> &gt; &gt; &gt; Almost,<br>
> &gt; &gt; &gt; it created the following output, which is a bit of a mess: <=
> br>
> &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &lt;span style=3D'font-family:Arial;mso-bidi-font-family:<br>
> &gt; &gt; &gt;&nbsp;&nbsp; &quot;Times New Roman&quot;'&lt;span
> class=3D'keyword'&gt;PHP&lt;/span&gt;&gt;<br>
> &gt; &gt; &gt;<br>
> &gt; &gt; &gt; <br>
> &gt; &gt; &gt; On 4/13/06, Blair McKenzie &lt;<a href=3D"mailto:[EMAIL 
> PROTECTED]
> l.com">[EMAIL PROTECTED]</a>&gt;
> wrote:<br>
> &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; If you left the body tags around the content (or div or
> something) <br>
> &gt; &gt; this<br>
> &gt; &gt; &gt; &gt; regex should only select keywords that are outside of a=
>  tag's
> &lt;&gt;.<br>
> &gt; &gt; &gt; &gt; &quot;&gt;[^&lt;]*(#variables.item#)[^&gt;]*&lt;&quot;<=
> br>
> &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; So: Select the keyword if there is no tag opening char
> between it and <br>
> &gt; &gt; the<br>
> &gt; &gt; &gt; &gt; last tag close, and there is no tag closing char betwee=
> n it
> and the<br>
> &gt; &gt; next tag<br>
> &gt; &gt; &gt; &gt; open.<br>
> &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; <br>
> &gt; &gt; &gt; &gt; On 4/13/06, Taco Fleur &lt;<a
> href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>&gt; wrote:<br>
> &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt;&nbsp;&nbsp;To split up the html<br>
> &gt; &gt; &gt; &gt; &gt; <br>
> &gt; &gt; &gt; &gt; &gt; variables.result =3D reFindNoCase(
> &quot;&lt;body[^&gt;]+&gt;(.+)&lt;/body&gt;&quot;,<br>
> &gt; &gt; &gt; &gt; &gt; variables.htmlContent, 1, true );<br>
> &gt; &gt; &gt; &gt; &gt; variables.htmlContentHeader =3D left(
> variables.htmlContent,<br>
> &gt; &gt; result.pos[ 2<br>
> &gt; &gt; &gt; &gt; &gt; ] );<br>
> &gt; &gt; &gt; &gt; &gt; variables.htmlContentBody =3D mid(
> variables.htmlContent, result.pos[<br>
> &gt; &gt; 2 ],<br>
> &gt; &gt; &gt; &gt; &gt; result.len[ 2 ] );<br>
> &gt; &gt; &gt; &gt; &gt; variables.htmlContentFooter =3D right(
> variables.htmlContent, ( len(<br>
> &gt; &gt; &gt; &gt; &gt; variables.htmlContent ) +1 ) - ( result.pos[ 2 ] +
> result.len[ 2 ]<br>
> &gt; &gt; )); <br>
> &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; To highlight the keyword<br>
> &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &lt;cfset variables.htmlHighlightedContent =3D
> reReplaceNoCase(<br>
> &gt; &gt; &gt; &gt; &gt; variables.htmlHighlightedContent,
> &quot;(#variables.item#)&quot;, &quot;&lt;span<br>
> &gt; &gt; &gt; &gt; &gt; class=3D'keyword'&gt;\1&lt;/span&gt;&quot;,
> &quot;all&quot; ) /&gt;<br>
> &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; <br>
> &gt; &gt; &gt; &gt; &gt;&nbsp;&nbsp;On 4/13/06, Blair McKenzie &lt;<a
> href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>&gt; wrote:<br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; What are you using at the moment? <br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; On 4/13/06, Taco Fleur &lt;<a
> href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> &gt; wrote:<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; <br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt;&nbsp;&nbsp;I'm drawing a blank on coming=
>  up
> with a regex for the<br>
> &gt; &gt; following;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; I have some HTML that I read in a variab=
> le,
> then I highlight the <br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; keywords with a regex, which is fine, but
> some keywords might be<br>
> &gt; &gt; contained<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; within a tag, for example
> &lt;html&gt;&lt;strong&gt; etc, I don't want to <br>
> &gt; &gt; highlight<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; those, what would the regex need to look
> like, anyone any idea<br>
> &gt; &gt; on this one?<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; thanks. <br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; --<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; Taco Fleur - <a
> href=3D"http://www.pacificfox.com.au";>http://www.pacificfox.com.au</a><br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; Web Design, Web development, Graphic Des=
> ign
> and Complete <br>
> &gt; &gt; Internet<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; Solutions<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; an industry leader with commercial IT
> experience since 1994 ?<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt; <br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt; an industry leader with commercial IT experie=
> nce
> since 1994 ? <br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; &gt;<br>
> &gt; &gt; &gt; &gt; <br>
> &gt; &gt; &gt;<br>
> &gt; &gt; &gt;<br>
> &gt; &gt; &gt; --<br>
> &gt; &gt; &gt; Taco Fleur - <a href=3D"http://www.pacificfox.com.au";>http:/=
> /www.pacificfox.com.au</a><br>
> &gt; &gt; &gt; Web Design, Web development, Graphic Design and Complete
> Internet <br>
> &gt; &gt; Solutions<br>
> &gt; &gt; &gt; an industry leader with commercial IT experience since 1994 =
> ?<br>
> &gt; &gt; &gt;<br>
> &gt; &gt; &gt;<br>
> &gt; &gt; &gt;<br>
> &gt; &gt;<br>
> &gt; &gt; &gt;<br>
> &gt; &gt;<br>
> &gt;<br>
> &gt;<br>
> &gt; --<br>
> &gt; Taco Fleur - <a href=3D"http://www.pacificfox.com.au";>http://www.pacif=
> icfox.com.au</a><br>
> &gt; Web Design, Web development, Graphic Design and Complete Internet
> Solutions<br>
> &gt; an industry leader with commercial IT experience since 1994 ? <br>
> &gt;<br>
> &gt;<br>
> &gt;<br>
> <br>
> <br>
> -- <br>
> Taco Fleur - <a href=3D"http://www.pacificfox.com.au";>http://www.pacificfox=
> .com.au</a>
> <br>
> Web Design, Web development, Graphic Design and Complete Internet Solutions=
> <br>
> an industry leader with commercial IT experience since 1994 &#8230; <br>
>
> </div>
>
> </div>
>
> </body>
> 
> </html>
> 
> ------=_NextPart_000_005F_01C65FF2.93B89630--


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to