How does this work for you...

<cfset text = "<a href=""http://www.google.com"";>GOOGLE</a><p>A para graph
sir</p><li>List</li><li>Another one</li>" />

<cfoutput>

#HTMLEditFormat(text)#

<p>------------</p>

#HTMLEditFormat(REReplaceNoCase(text, "(<[a|p|li])", "\1
class=""mainBody""", "ALL"))#

<p>------------</p>

#HTMLEditFormat(REReplaceNoCase(text, "<(a|p|li)", "<\1 class=""mainBody""",
"ALL"))#

</cfoutput>

The final REReplace seems to work.

I'm not too hot on REGEX either but it seems to be doing what you need.

Ade

-----Original Message-----
From: Damian Watson [mailto:[EMAIL PROTECTED]
Sent: 20 October 2003 10:17
To: [EMAIL PROTECTED]
Subject: Re: [ cf-dev ] Regex


Is there a way around that -- just tried a couple of things to no avail!

----- Original Message ----- 
From: "Rich Wild" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 20, 2003 10:07 AM
Subject: RE: [ cf-dev ] Regex


this bit: [a|p|li] only matches single characters, you its finding the L and
using that in the replace.

> -----Original Message-----
> From: Damian Watson [mailto:[EMAIL PROTECTED]
> Sent: 20 October 2003 10:02
> To: [EMAIL PROTECTED]
> Subject: Re: [ cf-dev ] Regex
>
>
> Ok then, one final thang... I've now bunged the list tag in
> there: #rereplacenocase(body, '(<[a|p|li])', '\1
> class="mainBody"', "ALL")#
>
> but the end result in the code is: <L class="mainBody"I>
>
> eep! Why it do dat?
>
>
> ----- Original Message ----- 
> From: "Rich Wild" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, October 20, 2003 9:55 AM
> Subject: RE: [ cf-dev ] Regex
>
>
> yea - it is difficult to get your head around, but once you
> start using them and feeling the awesome power of the Death
> Star, erm... regex then you'll find them immensely rewarding
> - especially when you can lose 9 or 10 lines of replace code.
>
> > -----Original Message-----
> > From: Stephen Pope [mailto:[EMAIL PROTECTED]
> > Sent: 20 October 2003 09:51
> > To: [EMAIL PROTECTED]
> > Subject: RE: [ cf-dev ] Regex
> >
> >
> > Ive avoided regex for so long but so much stuff here is in
> Perl that I
> > couldn't avoid it any longer ! Its quite a learning curve hehe but
> > with a bizarre sense of satisfaction at the end ! :¬)
> >
> > Stephen
> >
> > -----Original Message-----
> > From: Damian Watson [mailto:[EMAIL PROTECTED]
> > Sent: 20 October 2003 09:48
> > To: [EMAIL PROTECTED]
> > Subject: Re: [ cf-dev ] Regex
> >
> > Got it now, not only is it Monday morning, I'm also at the
> lower end
> > of the regex learning curve- a painful combination if there
> ever was
> > one ;0)
> >
> > It's beginning to make sense though, I've passed the brain scramble
> > stage...
> >
> > ----- Original Message -----
> > From: "Stephen Pope" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, October 20, 2003 9:39 AM
> > Subject: RE: [ cf-dev ] Regex
> >
> >
> > \1 refers to a back-reference ( the stuff between the
> brackets in the
> > regex) .. if you wanted 2 you'd need 2 reg-ex's !
> >
> > I think .. it is Monday morning !
> >
> > Regards
> >
> > Stephen
> > -----Original Message-----
> > From: Damian Watson [mailto:[EMAIL PROTECTED]
> > Sent: 20 October 2003 09:36
> > To: [EMAIL PROTECTED]
> > Subject: Re: [ cf-dev ] Regex
> >
> > Works a treat Rich, thanks. Just out of interest can you do
> stuff like
> > '[\1 class="something" | \2 class="somethingelse"]' in the second
> > attribute?
> >
> > #rereplacenocase(body, '(<[a|p])', '\1 class="mainBody"', "ALL")#
> >
> > ----- Original Message -----
> > From: "Rich Wild" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, October 20, 2003 8:52 AM
> > Subject: RE: [ cf-dev ] Regex
> >
> >
> > > rereplacenocase(mystring, "(<[a|p])", "\1 class=whatever ", "ALL")
> > should
> > do
> > > it, haven't tested it though.
> > >
> > > > -----Original Message-----
> > > > From: Damian Watson [mailto:[EMAIL PROTECTED]
> > > > Sent: 19 October 2003 11:43
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [ cf-dev ] Regex
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I want a regex that replaces <p with <p class="whatever"
> > and <a with
> > > > <a class="whatever" -- is it possible to do this in one
> > or do I have
> > > > to run two expressions?
> > > >
> > > > d
> > > >
> > > >
> > > >
> > > > --
> > > > ** Archive:
> > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > > >
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > > > For human help, e-mail: [EMAIL PROTECTED]
> > > >
> > >
> > >
> > > --
> > > ** Archive:
> > http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > >
> >
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > [EMAIL PROTECTED] For
> > > human help, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> > --
> > ** Archive:
> http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> >
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED] For
> > human help, e-mail: [EMAIL PROTECTED]
> >
> >
> > --
> > ** Archive:
> http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> >
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED] For
> > human help, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> > --
> > ** Archive:
> http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> >
>
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED] For
> > human help, e-mail: [EMAIL PROTECTED]
> >
> >
> > --
> > ** Archive:
> http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> >
>
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED] For
> > human help, e-mail: [EMAIL PROTECTED]
> >
>
>
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
>
>
>
>
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
>


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]




-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to