House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  Regular Expressions (RegEx)

Extracting inner text from html code

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Chris,
Bryan Hogan
07/03/08 03:37 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bryan Hogan
07/03/2008 01:51 PM

I need help; I'm trying to extract the inner text of span elements. Please help.  I can only get as far as finding <span id="lblOrganizationName">. <span id="lblOrganizationName">I want this text</span>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Claude Schneegans
07/03/2008 02:25 PM

>>I'm trying to extract the inner text of span elements. See CF_REextract: http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm You can test it on line here: http://www.contentbox.com/claude/customtags/REextract/testingREextract.cfm - Enter <span[^>]*> in RE1 - Enter </span in RE2 - Select OUTPUTMODE = List - Enter <span id="lblOrganizationName">I want this text</span> in Sample text - Click Test -- _______________________________________ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: piegeacon@internetique.com) Thanks.

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bryan Hogan
07/03/2008 03:37 PM

Chris, Thanks this worked perfectly. Bryan ________________________________ Sent: Thursday, July 03, 2008 12:18 PM To: cf-regex@houseoffusion.com; Bryan Hogan Subject: Re: Extracting inner text from html code i really wish claude would stop promoting his code, on the regex list, and instead actually try to answer questions.. to answer your question, use this regex <span.*?>(.*?)</span> it will lazy (non-greedy) match everything between span tags. you can make it more specific by adding things inside the opening span tag, for example: <span id="123asdf".*?>(.*?)</span> or if you are like me and dont standardize your tags... <span.*?id=["']asdf123["'].*?>(.*?)</span> Hope this helps! -Chris On Thu, Jul 3, 2008 at 2:23 PM, Claude Schneegans <schneegans@internetique.com> wrote: >>I'm trying to extract the inner text of span elements. See CF_REextract: http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm You can test it on line here: http://www.contentbox.com/claude/customtags/REextract/testingREextract.c fm - Enter <span[^>]*> in RE1 - Enter </span in RE2 - Select OUTPUTMODE = List - Enter <span id="lblOrganizationName">I want this text</span> in Sample text - Click Test -- _______________________________________ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: piegeacon@internetique.com) Thanks.


<< Previous Thread Today's Threads Next Thread >>

Search regex

May 20, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference