|
Mailing Lists
|
Home /
Groups /
Regular Expressions (RegEx)
Extracting inner text from html code
I need help; I'm trying to extract the inner text of span elements.Bryan Hogan 07/03/08 01:51 P >>I'm trying to extract the inner text of span elements.Claude Schneegans 07/03/08 02:25 P Chris,Bryan Hogan 07/03/08 03:37 P 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> >>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. 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.
|
May 20, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||