-
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 nend
This is a program that I made to help my self learn better regular expressions.
There are a lot of other programs/website with the similar functions.
The main advantage of this program is that you don't have to click a button after every changes.
The program detected changes and react on it.
Function:
Match Match of arrays Match and replace Load source data from website Load source data from a website with GET/POST Load text data from file Clear fields Export and Import settings (you can finish the expression a other time, just export/import it) Cheat sheet DPI aware Generate AutoIt code example code The source code is not difficult and I think most user will understand it.
In the zip file there is a export files (reg back example), you can drag and drop this files on the gui to import it.
EDIT: Updated to version V1.2.0
Changes are:
Expand and collapse of the cheat sheet (Thanks to Melba23 for the Guiextender UDF) Usefull regular expressions websites links included in the program Text data update time EDIT: Updated to version V1.3.0
Changes are:
Automatic generate AutoIt code Icons on the tab Few minor bug fixes EDIT: Updated to version V1.4.0
Changes are:
Link to AutoIt regex helpfile If the regular expression has a error than the text becomes red Option Offset with Match and array of Matches Option Count with Match and replace Some small minor bug fixed EDIT: Updated to version V1.4.1
Changes are:
Small bug in "create AutoIt" code fixed EDIT: Updated to version V1.4.2
Changes are:
Small bug in "create AutoIt" code fixed Bug with website data fixed EDIT: Updated to version V1.4.3
Changes are:
DPI aware Click function on cheat sheet to insert function in the regex input field
(Sourcode, example and compiled exe file) Regex toolkit.zip
-
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).
Script:
#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.
Cheers
-
By Gianni
Hi all,
is there a regular expression pattern that can be used to remove part of a string based on the position of the substring, that is, by specifying the start and end characters of the block to remove? thus obtaining a new string without the "piece" indicated.
for example:
Global $sString = "Today I do not feel good" ; chars: 000000000111111111122222 ; 123456789012345678901234 ; remove a chunk from char 9 to char 15 MsgBox(0, '', _StringTrimMid($sString, 9, 15)) ; Returns the string trimmed by characters from $iStartCut to $iEndCut. Func _StringTrimMid($sInput, $iStartCut, $iEndCut) Return StringLeft($sInput, $iStartCut - 1) & StringMid($sInput, $iEndCut + 1) ; can be done the same with a RegExp ?? EndFunc ;==>_StringTrimMid
-
By cruisepandey
Hi,
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
-