Jump to content
nend

Regex toolkit

Recommended Posts

argumentum

why Func _ReduceMemory() ?.
I believe it'd be better without it.

Thanks for sharing.

Share this post


Link to post
Share on other sites
nend
11 hours ago, argumentum said:

why Func _ReduceMemory() ?.
I believe it'd be better without it.

Thanks for sharing.

Is far as I know it compres the used memory.

Why do you believe it's better without it?

  • Like 1

Share this post


Link to post
Share on other sites
argumentum
2 hours ago, nend said:

Why do you believe it's better without it?

I don't remember very clearly the discussion here in the forums, but I remember it was useless. Try a compiled script with it and without it. You'll find that is not needed. Try for yourself.

  • Like 2

Share this post


Link to post
Share on other sites
BrewManNH

It's not needed because it actually makes your script much slower with a large amount of data. What this function does is takes the memory used by the program and dumps it to disk in the page file. Reading data from a file is many times slower than reading the same data from memory. Also, having more free memory means that all the money you spent on that 16Gbs of memory was a waste, because you're not actually using it. This was a useless holdover from the XP days, and wasn't even needed back then either.

  • Like 3

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
nend

@argumentum thank for letting me know.

@BrewManNH thanks for explaining it, I used it in a lot of script and with this in mind I will get rid of this chunck of code.

Edited by nend
  • Like 1

Share this post


Link to post
Share on other sites
UEZ

Seems to be a very handy RegEx tool. :thumbsup:

My three suggestions:

  1. import text from clipboard
  2. resizeable GUI for larger edit controls
  3. show/hide functionality of the right help panel to make the GUI more compact

 

Drag'n drop doesn't load the text file.

  • Like 2

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
nend
3 hours ago, UEZ said:

Seems to be a very handy RegEx tool. :thumbsup:

My three suggestions:

  1. import text from clipboard
  2. resizeable GUI for larger edit controls
  3. show/hide functionality of the right help panel to make the GUI more compact

 

Drag'n drop doesn't load the text file.

Thanks!!

1. import text from clipboard

Good idea!

2. resizeable GUI for larger edit controls

I've tryed that but the "Regular expression output data" edit control wouldn't resize right, I think it has something to do this one is the middle.

3. show/hide functionality of the right help panel to make the GUI more compact

Also a good idea, I will look into it

Drag'n drop doesn't load the text file.

The drag'n drop is only for the export file to import (*.ini file)

Share this post


Link to post
Share on other sites
nend

New version V1.2.0

See the first post for the changes.

Share this post


Link to post
Share on other sites
NDog

Hi there, could this tool generate autoit code from this tool?

I'm using the match and replace option and then manually writing StringRegExpReplace() function, but the code does not work as described in the Regex toolkit, presumably I don't know what function I should use, hence the request

 

Share this post


Link to post
Share on other sites
nend
On 1-12-2017 at 1:07 AM, NDog said:

Hi there, could this tool generate autoit code from this tool?

I'm using the match and replace option and then manually writing StringRegExpReplace() function, but the code does not work as described in the Regex toolkit, presumably I don't know what function I should use, hence the request

 

I made a new version where this is possible, see the latest version (V1.3.0).

  • Like 1

Share this post


Link to post
Share on other sites
nend

A small update for the ones that use this program V1.4.0.
See the first post in this topic!

  • Like 1

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • therks
      By therks
      I'm looking for a regex genius, cus I'm stumped when it comes to assertions.
      So what I have now, is this regular expression: ([^|=]+)=([^|]+)
      It takes a string (user input) of keys=values separated by pipes (ie: "param=value|param=value") and splits them into an array.
      Example:
      $vParamData = 'example=value|fruit=apple|phrase=Hello world' $aRegEx = StringRegExp($vParamData, '([^|=]+)=([^|]+)', 3) ; Result ; [0] => example ; [1] => value ; [2] => fruit ; [3] => apple ; [4] => phrase ; [5] => Hello world So that's working fine, but I'm wondering if there's also a way I could have this capture escaped pipes instead of splitting by them.
      ie:
      $vParamData = 'pipe test=this \| is a pipe|example=value' $aRegEx = StringRegExp($vParamData, '([^|=]+)=([^|]+)', 3) ; I'm getting this: ; [0] => pipe test ; [1] => this \ ; [2] => example ; [3] => value ; But I'd like a result like this: ; [0] => pipe test ; [1] => this \| is a pipe ; [2] => example ; [3] => value Is there some pattern that would accomplish this, or am I better off parsing it some other way?
    • Chimp
      By Chimp
      regex and iso escape sequences
      Hi, I would like to extract all ISO escape squences embedded in a string and separate them from the rest of the string, still keeping the information about their position, so that, for exemple, a string like this one (or even more complex):
      (the string could start with normal text or iso sequences)
       
      '\u001B[4mUnicorn\u001B[0m' should be 'transformed' in an array like this
      $a[0] = '\u001B[4m' ; first iso escape sequence $a[1] = 'Unicorn' ; normal text $a[2] = '\u001B[4m' ; second iso escape sequence ... and so on (note: the above escape sequence has 'control codes' marked as "\u001B' for the asc "esc" char for exemple and a similar notation is also used for other control chars, but in the real string to be parsed those control chars  are embedded  as a single byte with a value from 01 to 31). at this link (http://artscene.textfiles.com/ansi/) there are many example of real ANSI text files .
      searching on the web I've found some possible solutions that make use of regexp to achieve similar purpose, and above some others, the regexp pattern posted in the following link by kfir (https://stackoverflow.com/questions/14693701/how-can-i-remove-the-ansi-escape-sequences-from-a-string-in-python) seems to be able to catch a wider range of ISO escape sequences (not only color sequences), but my lack of skills on regexp, prevents me from evaluating and testing such patterns
      I would be very grateful if some regexp guru could come to my rescue...
      thanks everybody  for reading...
    • ur
      By ur
      I am trying to identify the window based on the window title and text.
      The title will be the "erwin DM - filename"

      It is working till date, but some operating systems our application is displaying window as "erwin DM - [filename]"
       
      I tried  "erwin DM - *filename*" But this regular expression is not working.
      Any suggestion?
       
      $sModelFile = "C:\Users\Administrator\Documents\My Models\eMovies.erwin" $wdModel = _WinWaitActivate1("erwin DM - "&FileNameOnly($sModelFile),"") Func _WinWaitActivate1($title,$text,$timeout=0);Will Return the window Handler Logging("Waiting for "&$title&":"&$text) $dHandle = WinWait($title,$text,$timeout) if not ($dHandle = 0) then If Not WinActive($title,$text) Then WinActivate($title,$text) return WinWaitActive($title,$text,$timeout) Else Logging("Timeout occured while waiting for the window...") Exit EndIf EndFunc Func FileNameOnly($sFilePath) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) ;_ArrayDisplay($aPathSplit, "_PathSplit of " & @ScriptFullPath) return $sFileName EndFunc  
    • nikink
      By nikink
      Hi all, it's been a while since I last used regular expressions and I find myself out of time to experiment with this particular issue, so I throw myself upon your mercy and expertise.
      I am looking to create a function that will say whether or not a supplied string is a valid UUID or not.
      Local $sTestF = '4C4C4544-004A-4C10-8054-B7C04F46343' Local $sTestT = '4C4C4544-004A-4C10-8054-B7C04F463432' ConsoleWrite('False = ' & _IsValidUUID($sTestF) & @CRLF) ConsoleWrite('True = ' & _IsValidUUID($sTestT) & @CRLF) Func _IsValidUUID($sUUID) ;[\p{XDigit}]{8}-[\p{XDigit}]{4}-[34][\p{XDigit}]{3}-[89ab][\p{XDigit}]{3}-[\p{XDigit}]{12} ; Test UUID = '4C4C4544-004A-4C10-8054-B7C04F463432' Local $sRegExp = '([:xdigit:]){8}\-([:xdigit:]){4}\-([34])([:xdigit:]){3}\-([89ab])([:xdigit:]){3}\-([:xdigit:]){12}' ConsoleWrite(StringRegExp($sUUID, $sRegExp) & @CRLF) Local $Result = StringRegExp($sUUID, $sRegExp) ConsoleWrite($Result & @CRLF) If @error Then ConsoleWrite('Error: [' & @error & ']' & @CRLF) Return 'False' Else ConsoleWrite('Error2: [' & @error & ']' & @CRLF) Return 'True' EndIf EndFunc In the line under the Function call, you'll see the regex I found to do this from a google search. That was my starting point, and I'm trying to get it to work in Au3 and failing miserably.
      $sTestF is a known invalid String
      $sTestT is a known valid String
      Everything I've tried so far has produced the same results for both.
      Any help you could provide me is greatly appreciated. Thanks for your time!
    • sjaikumar
      By sjaikumar
      I am looking to writing an automation script for converting the following SQL procedure code into VBCode as shown below
      Example
       
      ALTER PROCEDURE [dbo].[firstprocedure] (        @var1 varchar(10),        @var2 varchar(7),        @var3 float )    CONVERSION Public Function firstprocedure(ByVal var1 As String, ByVal var2 As String, ByVal var3 As Integer) As DataSet         Dim ds As New DataSet()         '**************query  with stored procedure**********         Dim CMD As New SqlCommand("GetCountOfTempGramWtsGwByFoodCodeProgressAndNewSequence")         CMD.Connection = GetConnection()         CMD.Parameters.Add("@var1", SqlDbType.VarChar).Value = var1         CMD.Parameters.Add("@var2", SqlDbType.VarChar).Value = var2         CMD.Parameters.Add("@var3", SqlDbType.Float).Value = var3         CMD.CommandType = CommandType.StoredProcedure         Dim adapter As New SqlDataAdapter(CMD)  

       
      I will be reading the procedural code from the first file that has to be read and create the VB code by writing onto a new file.
      My approach is that I need the following information captured in Variables which I can insert later onto the new file as and where applicable.
       
      In order to do that I need to extract the following bit of information from the file to be READ
      Name of procedure : firstprocedure
      List of Variables : @var1, @var2, @var3  
      Data Types: varchar, varchar & float
       
      What I need help with is extracting the list of variables and data types in separate variables.
      I am looking to build a Regular Expression which I can use to achieve the same. 
      I tried making use of StringSplit function delimited on spaces(" ") but that did not work when reading the file from notepad. I reckon it does not detect spaces in the file.
      Please help me with the RegExp.
      Any other suggestions on how best to go about doing this conversion are also welcome.
      Thank You
       
       
×