:D

So you want:

1) to find all instances of this string (with different attributes):

<mytag name="test height="10" width="50" renderer="q6" id="66565656">

2) extract all of the attribute values (as name value pairs or just the
values?)

Test 10 50 q6 66565656

3) replace the tag with a UDF:

<cfset a = myUDF("Test", 10, 50, "q6", "665656565")>

Yes?

If so...

1) find all instances of the string (assumptions made on values):

Mytag[ ]+name="[^"]+"[ ]+height="[0-9]+"[ ]+width="[0-9]+"[
]+renderer="[^"]+" id="[0-9]+">

Escape all quotes

<mytag[ ]+name=""[^""]+""[ ]+height=""[0-9]+""[ ]+width=""[0-9]+""[
]+renderer=""[^""]+"" id=""[0-9]+"">

2 and 3) extract value using REReplace and backreferences (watch wrapping)

<cfset regex = <mytag[ ]+name=""([^""]+)""[ ]+height=""([0-9]+)""[
]+width=""([0-9]+)""[ ]+renderer=""([^""]+)"" id=""([0-9]+)"">">
<cfscript>
        myPage = REReplace(myPage, regex, "<cfset a = myUDF("\1", \2, \3,
"\4", "\5")>", "all");
</cfscript>

HTH

Paul
> -----Original Message-----
> From: Alex Skinner [mailto:[EMAIL PROTECTED] 
> Sent: 17 June 2003 13:04
> To: [EMAIL PROTECTED]
> Subject: [ cf-dev ] ot: regex
> 
> 
> Guys,
> 
> anyone know how in a regex I can
> 
> go through a large text string and for every instance of
> 
> <mytag name="test height="10" width="50" renderer="q6" id="66565656">
> 
> run some code extracting those attributes and passing those 
> values into a udf RunRenderer(name,height,width,renderer,id)
> 
> and replace the output over the tag
> 
> no its not going to be pure regex but cant use xml as these 
> tags may be in a data set which isn't xml or xhtml ?
> 
> Nightmare
> 
> anyone any ideas or starting points?
> 
> Alex
> 
> 
> 
> 
> -- 
> ** 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