Digisoul Posted June 16, 2009 Posted June 16, 2009 I want to extract the data from the Tags of Html File e.g: Tag: <tag attribute= also need this>The Data</tag> I am using : StringRegExp($file_data, "<(?i)tag(.*?)</(?i)tag>", 3) its working well but in this condition its failed: Tag: <tag attribute= also need this>The Data With New Line </tag> What the pattern i should use to extract the data ? Thanks in advance for your kind help. 73 108 111 118 101 65 117 116 111 105 116
Zedna Posted June 16, 2009 Posted June 16, 2009 (edited) add: (?s) #include <array.au3> $file_data = "<tag attribute= also need this>The " & @CRLF & "Data" & @CRLF & "New Line</tag>"$ret = StringRegExp($file_data, "(?s)<tag(.*?)</tag>", 3) _ArrayDisplay($ret) Edited June 16, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Digisoul Posted June 16, 2009 Author Posted June 16, 2009 add: (?s) #include <array.au3> $file_data = "<tag attribute= also need this>The " & @CRLF & "Data" & @CRLF & "New Line</tag>"$ret = StringRegExp($file_data, "(?s)<tag(.*?)</tag>", 3) _ArrayDisplay($ret)Thank you very much 73 108 111 118 101 65 117 116 111 105 116
PsaltyDS Posted June 16, 2009 Posted June 16, 2009 (edited) I want to extract the data from the Tags of Html File e.g: Tag: <tag attribute= also need this>The Data</tag> I am using : StringRegExp($file_data, "<(?i)tag(.*?)</(?i)tag>", 3) its working well but in this condition its failed: Tag: <tag attribute= also need this>The Data With New Line </tag> What the pattern i should use to extract the data ? Thanks in advance for your kind help. Use "(?s)" to include newlines in the data: #include <Array.au3> $sString = "<tag attribute= also need this>The" & @CRLF & _ "Data" & @CRLF & _ "With" & @CRLF & _ "New" & @CRLF & _ "Line" & @CRLF & _ "</tag>" & @CRLF & _ "<tag attribute= and this>Single line data</tag>" & @CRLF & _ "<tag attribute= and finally this>The" & @CRLF & _ "Data" & @CRLF & _ "With" & @CRLF & _ "New" & @CRLF & _ "Line" & @CRLF & _ "</tag>" & @CRLF $avRET = StringRegExp($sString, "(?s)<(?i)tag(.*?)</(?i)tag>", 3) _ArrayDisplay($avRET, "$avRET") Edit: Well, I guess I was a little slow there... Edited June 16, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now