Kovitt Posted June 27, 2008 Share Posted June 27, 2008 (edited) Hello, How would I write a StringRegExp that looks for this between a + and a s or a - and an s. I first tried with _StringBetween() but I need it to scan a whole document.. the output it needs to search through looks like: Analyzing TESTCOMPUTER (1 of 1)... resolving referer 59.64.64.63 (1 of 1)... TESTCOMPUTER [15.3.6.452]: ICMP: 0ms delay. NTP: +17.5781250s offset from local clock RefID: 'LOCL' [59.64.64.63 ] It needs to find whats after NTP: which in some cases could be negative.. Any Suggestions? What I have tried is: StringRegExp($times,'([+]{1},[:digit]{1,},[.]{1},[:digit]{1,}? but this wont do + or - Thanks Edited July 2, 2008 by Kovitt Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 27, 2008 Moderators Share Posted June 27, 2008 "NTP:\s*([\+-].+?)s" Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Kovitt Posted June 27, 2008 Author Share Posted June 27, 2008 "NTP:\s*([\+-].+?)s" Thank you for the response!! So it would be StringRegExp($times,'(NTP:\s*([\+-].+?)s)?:') ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 27, 2008 Moderators Share Posted June 27, 2008 Thank you for the response!! So it would be StringRegExp($times,'(NTP:\s*([\+-].+?)s)?:') ?$a_sre = StringRegExp($times, "NTP:\s*([\+-].+?)s", 3) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Kovitt Posted June 27, 2008 Author Share Posted June 27, 2008 $a_sre = StringRegExp($times, "NTP:\s*([\+-].+?)s", 3)Thanks your a huge help! Link to comment Share on other sites More sharing options...
Kovitt Posted July 2, 2008 Author Share Posted July 2, 2008 $a_sre = StringRegExp($times, "NTP:\s*([\+-].+?)s", 3) How would I modify this to not include the + or - ? Thanks Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 2, 2008 Share Posted July 2, 2008 #include <Array.au3> $string = 'NTP: +17.5781250s offset from local clock' $re = StringRegExp($string, 'NTP:\s*[\+-](.+?)s', 3) _ArrayDisplay($re) Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Kovitt Posted July 2, 2008 Author Share Posted July 2, 2008 #include <Array.au3> $string = 'NTP: +17.5781250s offset from local clock' $re = StringRegExp($string, 'NTP:\s*[\+-](.+?)s', 3) _ArrayDisplay($re)Perfect! Thanks!! Link to comment Share on other sites More sharing options...
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