Leaderboard
Popular Content
Showing content with the highest reputation on 02/15/2023 in all areas
-
WebDriver UDF (W3C compliant version) - 2024/09/21
SOLVE-SMART and one other reacted to Danp2 for a topic
Latest update just released. See below for change log.2 points -
RegExpQuickTester 2.5r
CYCho reacted to pixelsearch for a topic
Hi everybody Here is the script I use to test RegEx patterns offline, it's handy. Credits go to Lazycat, who scripted it initially many years ago and thanked "w0uter for ideas and parts of code". I added some modifications (listed in next post) and would like to thank @jchd @mLipok @mikell @Nine @mistersquirrle @taurus905 and @ioa747 for their contribution. Below are the match text & patterns corresponding to the pic above. For a start, you can copy and paste them in their respective edit control. After you choose the corresponding RegExp mode from the ComboBox at the bottom of the screen (mode 3 = return array of global matches) then you'll have the same results as displayed in the pic above. Match Text : blabla...blabla... blabla..."https://media.pic1.jpg"blabla..."https://media.pic2.png"... blabla..."https://media.pic3.jpg"blabla..."https://media.pic4.png"... blabla...blabla... Pattern : (?i)"([^"]+?\.(?:jpg|png))" When you end the script, 2 files will be created in the same directory of the script. Assuming your script is named "RegExpQuickTester 2.5p.au3", the 2 files created will be : * "RegExpQuickTester 2.5p.txt" which contains the saved Match Text that will be reused when you run the script. * "RegExpQuickTester 2.5p.ini" which contains the saved options that will be reused when you run the script. A right click while hovering over the Edit control of the Search Pattern will display a helpful context menu, with possibility to paste something from the menu inside the Search Pattern. Personally I nearly don't paste anything from the context menu but as this feature was created by the original scripter... Instead I like to consult this context menu as a RegExp syntax reminder ! Anyway, just experiment it and choose what's best for you. 99% of the time, the Search Pattern Tab will be on top. If you notice another colored Tab (except the Personal Tab which will never be highlited), then it means that there is something written in this other tab : the color is here only to remind you that there IS something in this other tab, in case you had forgotten. Even a space or a blank line would color the Tab. YJ This particular design (due to original scripter) won't allow you to type "" in the Replace Pattern Tab (mikell frowned, concerning this missing feature). Gladly I found that typing a non existing group, for example $99 will have the same effect as "" so it's a workaround that seems to do the job. The "Code" button allows you to generate the corresponding AutoIt code, which will be copied to the Clipboard Don't hesitate to ask if you have questions. Our RegExp gurus (that's not me) just love RegExp questions Edit: I forgot. You can drag a text file (or htm etc...) inside the Match Text edit control (it's a droppable zone) . There shouldn't be a 32Kb file size limit anymore as I added code to override this limit. There are probably a couple of other functionalities I'm not thinking of now, you'll easily find what you need if you look at the code. And if you want to modify something in the code, don't hesitate. Just share here your modifications in case other users find them useful too, thanks. Updates are detailed in next post Download last version 11 nov 2024 : RegExpQuickTester 2.5r.au31 point -
RegExpQuickTester 2.5r
pixelsearch reacted to ioa747 for a topic
@pixelsearch Well done, your tool is very good, especially (and not only) for beginners. With the guide on the right click, it guides you briefly, and explains what the symbols do. Congratulations ! if i could suggest, since I see that there is a position available on the right of the tabs. or a hole between the buttons to give the complete code, for copying in the form (ready for delivery) #include <Debug.au3> Local $sRegex = '"data":"([^"]+)"' Local $sString = '[[{"records":{"data":"random data"}}],[{"filtered":{"data":"unknown variable"}}],[{"duplicate":{"data":"not constant"}}],{"subject":"Test"}]' Local $aArray = StringRegExp($sString, $sRegex, 3) _DebugArrayDisplay($aArray)1 point -
A thin RTF Printer for RTF Files
argumentum reacted to ptrex for a topic
1 point -
Hello World from Python
Nisteo reacted to AspirinJunkie for a topic
I don't expect extreme improvements there, since only few commands have to be parsed here in the concrete case. The situation is different if you have a loop, for example, and the commands there have to be chased through the (byte code) interpreter again and again. These are the cases where Pypy can show its strengths. Anyway, I ran it through Pypy and got an execution speed of ~90ms. So no major improvement. If it is concretely only about json, then you can also fall back on other special tools such as jq and get similar performance but save the whole Python overhead:: ConsoleWrite(_jq_run('instances.json', _ '.[0][0], ' _ & '.[0][1].flag, ' _ & '.[0][1].region, ' _ & '.[0][1].stats.version, ' _ & '.[0][1].stats.software.name, ' _ & '.[0][1].stats.software.version, ' _ & '.[0][1].stats.software.branch')) Func _jq_run($sFileName, $sJqCommand) Local $iPID = Run('jq.exe -r "' & $sJqCommand & '" "' & $sFileName & '"', @ScriptDir, @SW_Hide, 6) ProcessWaitClose($iPID) Return DllCall('user32.dll', 'BOOL', 'OemToChar', 'str', StdoutRead($iPID), 'str', '')[2] EndFunc1 point -
Hello World from Python
Nisteo reacted to AspirinJunkie for a topic
I have placed the pure AutoIt solution (with this UDF) for this next to it for comparison: #include "JSON.au3" $sString = FileRead("instances.json") $aJson_Data = _JSON_Parse($sString) ConsoleWrite(($aJson_Data[0])[0] & @CRLF) ConsoleWrite(($aJson_Data[0])[1].flag & @CRLF) ConsoleWrite(($aJson_Data[0])[1].region & @CRLF) ConsoleWrite(($aJson_Data[0])[1].stats.version & @CRLF) ConsoleWrite(($aJson_Data[0])[1].stats.software.name & @CRLF) ConsoleWrite(($aJson_Data[0])[1].stats.software.version & @CRLF) ConsoleWrite(($aJson_Data[0])[1].stats.software.branch & @CRLF) The required time for the script in my case: ~550ms For comparison: Your modified (so that it reads from the file instead of downloading first) script needs only ~120ms for me. That means almost a 5x increase in execution speed with your approach!1 point -
Hello World from Python
SOLVE-SMART reacted to Nisteo for a topic
I still don't see the point why not just using machine code for all actions instead of creating compilers and interpreters and billion programming languages and transpilers from one language to another and interpreted versions of compiled languages and compiled versions of interpreted languages and more and more... 🤣 For example, people using IronPython instead of C#, Cython instead of C, Brython instead of JavaScript, Jython instead of Java, etc, etc, etc... Because python is language mainly for non-qualified programmers like scientists or home linux users or something. Mixing easier and harder languages allows people to do complex things right now, instead of wasting 100 years for learning C and another 100 for debugging "Hello World" program. By the same logic, learning few functions from Python and calling them from Autoit is easier task, than learning whole Python. Rapid development, you know 😎1 point -
Regex: get only nth match not all
jugador reacted to pixelsearch for a topic
My goal was to display the whole $aArray in case several capture groups are found in a pattern, in mode 1, for example : #include <Array.au3> Local $Subject = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday" Local $Pattern = "\b(\w+)(day)\b" ; word ending with 'day' and 2 capture groups Local $Array = StringRegExp($Subject, $Pattern, $STR_REGEXPARRAYMATCH) ; mode 1 _ArrayDisplay($Array, "Mode 1 - two captures") One needs to remember that even in Mode 1, when the 1st match is found, several elements of the array can be populated, depending on the number of capture groups found in the pattern. This example is based on the different examples found in the french help file, topic StringRegExp, where examples and explanations are interesting too ( @jchd prepared this ? )1 point