[wtr-general] Re: Getting text between two br / tags
Thank you. I'm now using this regular expression: a .*\/abr\/\s*.*\s+br\/\s+a .*\/a\s+br\/\s+(.*)\s+br\/ This matches the first two links, the text between the first two links, the text I'm after, and the br / tag after it. One note though: it seems Watir takes out the forward slashes in the br / tags. My real code uses br in place of br/. - Aaron -Original Message- From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of Mark Anderson Sent: July 29, 2009 6:11 PM To: watir-general@googlegroups.com Subject: [wtr-general] Re: Getting text between two br / tags Here's how I would do it with a regular expression: $ie.html =~ /br\/\s*(.*)\s*br\/\s*Updated/ puts $1 That doesn't pull the tab before 'Text', and assumes that 'Updated' only appears once in the html. I don't guarantee that this regexp will work with any text other than what you provided above, where it returns Text I want to extract. in $1 and spits it out to the screen. Hope this gives you a starting place. /\/\ark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Getting text between two br / tags
Well, if the only text that is variable is the text within the a/a tags, are there any identifying marks for that link? an id? Otherwise, I suppose you could just get the text for the whole page and subtract the text you already know (i.e. the non-variable text). Not pretty or elegant, but it would get the job done. -Dylan On Jul 29, 12:47 pm, Aaron MacDonald aa...@genieknows.com wrote: There is a line of text that I want to extract. It is found in some HTML that follows this pattern: a href=...img src=...//abr/ !-- An image link -- Some text br/ a href=...Another link (variable text)/a br/ Text I want to extract. br/ Updated by a href=...name (variable)/a X hours ago [a href=...Comment/a] I have the impression that I'd use XPath somehow, but am unsure how to proceed since the text I want isn't in any page element. - Aaron --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Getting text between two br / tags
There is a line of text that I want to extract. It is found in some HTML that follows this pattern: a href=...img src=...//abr/ !-- An image link -- Some text br/ a href=...Another link (variable text)/a br/ Text I want to extract. br/ Updated by a href=...name (variable)/a X hours ago [a href=...Comment/a] I have the impression that I'd use XPath somehow, but am unsure how to proceed since the text I want isn't in any page element. - Aaron Here's how I would do it with a regular expression: $ie.html =~ /br\/\s*(.*)\s*br\/\s*Updated/ puts $1 That doesn't pull the tab before 'Text', and assumes that 'Updated' only appears once in the html. I don't guarantee that this regexp will work with any text other than what you provided above, where it returns Text I want to extract. in $1 and spits it out to the screen. Hope this gives you a starting place. /\/\ark __ Information from ESET NOD32 Antivirus, version of virus signature database 4289 (20090729) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---