youtuber Posted June 14, 2016 Posted June 14, 2016 I do have a question <div class="col-sm-5 text-right"> <a href="/">IP Your adress: 113.228.141.182</a> </div> Is it true? (?U)(\d+\d+\.\d+\.\d+\.\d+.\.)
Moderators Melba23 Posted June 14, 2016 Moderators Posted June 14, 2016 youtuber, Please do not hijack unrelated threads - just start a new one as I have now done for you. Quote Is it true? What happened when you tried it? M23 youtuber 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
youtuber Posted June 14, 2016 Author Posted June 14, 2016 (edited) yes I've tried, but it took all the ip addresses http://youtube.com/video.html $Data = StringRegExp($var, "(?U)(\d+\d+\.\d+\.\d+\.\d+.\.)", 3) I just want to get 113.228.141.182 Edited October 12, 2016 by youtuber
Moderators Melba23 Posted June 14, 2016 Moderators Posted June 14, 2016 youtuber, If all you want is to extract the IP then this should work: #include <Array.au3> $sSnippet = '<div class="col-sm-5 text-right">' & @CRLF & _ '<a href="/">IP Your adress: 113.228.141.182</a>' & @CRLF & _ '</div>' $aIP = StringRegExp($sSnippet, ":\s(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})<", 3) _ArrayDisplay($aIP, "", Default, 8) And if you had explained yourself clearly initially we might have got there quicker. M23 youtuber 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
mikell Posted June 14, 2016 Posted June 14, 2016 Anyway when using regex the more precise are with requirements, the best it works $txt = BinaryToString(InetRead("http://youtubertr.com/ipadres.html", 1) ) $IP = StringRegExpReplace($txt, '(?s).*Your adress:\h*([\d.]+).*', "$1") Msgbox(0,"", $IP) youtuber 1
youtuber Posted June 23, 2016 Author Posted June 23, 2016 help for it ;&u=http://www.example.com/news/&prev= StringRegExp($var, '(?i).*&\/amp\;u=(http:\/\/.+?)\&.*')
mikell Posted June 23, 2016 Posted June 23, 2016 How could you get a response with so little information about the text to treat and the expected result ?! youtuber 1
jchd Posted June 23, 2016 Posted June 23, 2016 (edited) $var = ";&u=http://www.example.com/news/&prev=" StringRegExp($var, '(?i)&u=(http://.+?)&') Maybe that (there was a spurious / in pattern), maybe not. BTW, no need to escape slash, semi-column or ampersand in pattern. Edited June 23, 2016 by jchd youtuber 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
youtuber Posted June 23, 2016 Author Posted June 23, 2016 (edited) On 23.06.2016 at 8:38 PM, jchd said: $var = ";&u=http://www.example.com/news/&prev=" StringRegExp($var, '(?i)&u=(http://.+?)&') Maybe that (there was a spurious / in pattern), maybe not. BTW, no need to escape slash, semi-column or ampersand in pattern. $Webadres = BinaryToString(InetRead("http://youtube.com/video.html", 1) ) $varweb = StringRegExp($Webadres, '(?i)&u=(http://.+?)&',3) Msgbox(0,"", $varweb) Edited October 12, 2016 by youtuber
jchd Posted June 23, 2016 Posted June 23, 2016 Yes there is! The result is an array, something that is explained in the help file. $Webadres = BinaryToString(InetRead("http://youtubertr.com/StringRegExp2.html", 1) ) $varweb = StringRegExp($Webadres, '(?i)&u=(http://.+?)&', 1) _ArrayDisplay($varweb) This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
youtuber Posted July 7, 2016 Author Posted July 7, 2016 (edited) I need the number zero #include <array.au3> $var = "z: <b>1</b><br> z: <b>3</b><br> z: <b>0</b><br>z: <b>5</b><br>" $varstr = StringRegExp($var, '(?i).+z:\h*<b>(\d+?)<\/b><br.*', 1) _ArrayDisplay($varstr) Edited October 12, 2016 by youtuber
Malkey Posted July 7, 2016 Posted July 7, 2016 Try this example. Local $var = "The beginning z: <b>1</b><br> z: <b>3</b><br> z: <b>0 (Zero the number that is needed.)</b><br>z: <b>5</b><br> The end" Local $iFindOccurence = 3 Local $varstr = StringRegExpReplace($var, '(?i).*?(?:z:\h*<b>.+?</b><br>\h*){' & ($iFindOccurence - 1) & '}z:\h*<b>([^<]+).*', "$1") ; If "0" is all that is required you could replace "([^<]+)" with "(\d)". MsgBox(0, "Result", $varstr) youtuber 1
youtuber Posted July 7, 2016 Author Posted July 7, 2016 not a fixed data sometimes it changes place $var = "z: <b>2</b><br> z: <b>0</b><br> z: <b>3</b><br> z: <b>1</b><br>z: <b>5</b><br>"
Malkey Posted July 7, 2016 Posted July 7, 2016 Maybe this example fulfills your need for the number zero. Local $var = "z: <b>2</b><br> z: <b>0</b><br> z: <b>3</b><br> z: <b>1</b><br>z: <b>5</b><br>" If StringRegExp($var, "z:\h*<b>0</b><br>") Then MsgBox(0, "Result", "Zero exists and is the " & StringInStr($var, "0") & " character from the start of the string") Else MsgBox(0, "Result", "Zero does not exist in the string") EndIf
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