Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

SRE guru challenge.

$
0
0
I was helping another user with extracting info from a GeoIP database, when I came upon the idea today that stripping useless data would speed up the process when enumerating through the array of (potentially useless) data. Since the first 2 digits are sequential generally throughout the database, I felt this would a good place to start.

So whilst I work on a SRE I thought I would give others the opportunity to join in. Not your normal support question, but sometimes nice just to take a break from the norm.

[ autoit ]      
#include <Constants.au3> #include <String.au3> Local $sString = '"1176919368","1176919375","US","UNITED STATES","NA","NORTH AMERICA"' & @CRLF $sString &= '"1176919376","1176919383","BG","BULGARIA","EU","EUROPE"' & @CRLF $sString &= '"1176919384","1176919391","US","UNITED STATES","NA","NORTH AMERICA"' & @CRLF $sString &= '"1247210584","1247212319","US","UNITED STATES","NA","NORTH AMERICA"' & @CRLF $sString &= '"1247212320","1247212351","CO","COLOMBIA","SA","SOUTH AMERICA"' & @CRLF $sString &= '"1247212352","1247212695","US","UNITED STATES","NA","NORTH AMERICA"' & @CRLF $sString &= '"1347225600","1347226623","PK","PAKISTAN","AS","ASIA"' & @CRLF $sString &= '"1347226624","1347227135","EG","EGYPT","ME","MIDDLE EAST"' & @CRLF $sString &= '"1347227136","1347227391","HK","HONG KONG","AS","ASIA"' & @CRLF Local $sIntString = '1249763400' ; Google: 74.125.224.72 Local $iInt = Int(StringLeft($sIntString, 2)) ; Extract the content that starts with "12\d{8} (these are random numbers) only and remove everything else. Local $aArray = _StringBetween($sString, '"' & $iInt, '"' & ($iInt + 1)) ; The end part may not exist, for example if I wanted the content of 13\d{8} then this example would fail. MsgBox($MB_SYSTEMMODAL, '', '"' & $iInt & $aArray[0])

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>