Jump to content
  1. careca


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By RAMzor
      Hi everyone,
      I have this string:
      "main_lot      0x111” & @CRLF & “main_version          0xABC” & @CRLF & “main_number 0xDEAD123” & @CRLF & “main_version          0x333"
      And I'm trying to extract one specific hexadecimal number, actually main_version from this string by using StringRegExp:
      How to get 'ABC' from it?
      I'm not sure if the original string uses @CRLF, @CR or @LF as a line breaks (received from linux over ssh plink.exe) I have tried this code but it doesn't work 
      #include <Array.au3> $sLog = "main_lot 0x111” & @CRLF & “main_version 0xABC” & @CRLF & “main_number 0xDEAD123” & @CRLF & “main_version 0x333" $aVer = StringRegExp($sLog, "main_version\h*(.+)(?:0[xX][[:xdigit:]])", 3) _ArrayDisplay($aVer)  
    • By FrancescoDiMuro
      Good morning
      I'm playing with SRE and trying to obtain some information from a test file.
      I was testing the pattern on regex101, but when I bring it to AutoIt, it doesn't return the same result as on regex101.
      I am surely (?:missing some important notes about PCRE engine|the pattern is not correct at all).
      #include <Array.au3> #include <StringConstants.au3> Test() Func Test() Local $strFileName = @ScriptDir & "\TestFile.txt", _ $strFileContent, _ $arrResult $strFileContent = FileRead($strFileName) If @error Then Return ConsoleWrite("FileRead ERR: " & @error & @CRLF) $arrResult = StringRegExp($strFileContent, '(?sx)User:\h([^\n]+)\n' & _ 'Login\-name:\h([^\n]+)\n' & _ '(?:CaseSensitive:\h([^\n]+)\n)?' & _ 'NTSecurity:\h([^\n]+)\n' & _ '(?:NO\n)?' & _ '(?:Domain:\h([^\n]+)\n)?' & _ 'Timeout:\h([^\n]+)\n' & _ '.*?' & _ 'Member:\h([^\n]+)\n', $STR_REGEXPARRAYGLOBALMATCH) If IsArray($arrResult) Then _ArrayDisplay($arrResult) EndFunc Test file:
      User: AMMINISTRATORE Login-name: ADM CaseSensitive: YES NTSecurity: NO NO Timeout: 00:05:00 Member: AMMINISTRATORI User: Test_User Login-name: Test_User NTSecurity: YES Domain: DNEU Timeout: 00:00:00 Member: OPERATORS Member: OPERATORS Any help (even from cats) it's highly appreciated.

    • By levila
      Hi guys, really need your help. How can i check every 5 min if my text file include String "Markus". Btw i need this function to run on my Logs file that are updated whenever some event is triggered (logs appear in same txt file). So i did test some codding to test isit possible.
      But somehow, it only detect for the 1st time String check, and keep coming the same output every time, it didnt check/read on the current txt file that has been updated.
      For this purpose i update txt file manually so i put String "Markus" and check, and try to remove it agn.
      Here is my code:
      $file = FileOpen("c:\hello.txt", 0) $read = FileRead($file) func _CheckString() If StringInStr($read, "Markus") Then $position = StringInStr($read, "Markus") MsgBox(0,"","Alert Found - Logs Line No "&$position, 5) FileClose($file) Else MsgBox(0,"","No Alert found", 5) FileClose($file) EndIf EndFunc $Mins = 0.5 ; i change to fewer min for testing purpose $Timer = TimerInit() While 1 If TimerDiff($Timer) > ($Mins * 60000) Then ; count per minute multiplied by 60sec. _CheckString() ConsoleWrite("30 Sec have passed!" & @CRLF) ; console to see if its running. $Timer = TimerInit() EndIf WEnd  
    • By cruisepandey
      I have a string like this : 
      Global $Msga = "urrent directory is /send.  (Submission of file with log number 29381077284 is confirmed)";
      I want to extract the number 29381077284  from the string. I did StringSplit to split based on "(" and then use space to reach there, But it's not a good choice. 
      Can anyone help me with regular expression to find the number from String using AutoIT. TIA
    • By DannyJ
      I have this example string:
      2020-06-08 09:23:33 : abcdefghifjklm How to trim just the right part? Or how to trim this text right to left?
      I want to trim this string right to left until ' : '.
      In ohter words: I need the 'abcdefghifklm' text.
      I have tried StringTrimRight, but that requires 
      The number of characters to trim. Unfortunately StringSplit trims the left part of the strings.
  • Create New...