The simple form, 1 pair of tags would be:

  <cfset input = "<number>12345</number>">

  <cfset Extract = ReReplaceNoCase(input, "<number>([^<]*)</number>", "\1")>
 

  <cfoutput><br>#Extract#</cfoutput>

A more general case is to extract multiple pairs into a tab-delimited list

  <cfset input = "<number>11</number><number>12</number><number>13</number>">

  <cfset Extract = Trim(ReReplaceNoCase(input, "<number>([^<]*)</number>",
    "\1#Chr(9)#", "ALL"))>

  <cfoutput><br>#Extract#</cfoutput>


HTH

Dick


At 11:43 PM -0800 2/14/01, David Shadovitz wrote:
>Can anyone show me a CF regular expression to extract the information
>between an opening and closing tag?  Two examples:
>
>1. <number>12345</number>
>I want to extract "12345".
>
>2. <string>Employee</string>
>I want to extract "Employee"
>
>The tag could be any single word, with no attributes.
>
>Thanks.
>-David

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to