Jump to content

Search the Community

Showing results for tags 'regexp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start






  1. Well the plan is to use the power of regular expressions engine of AutoIT for patching binary data. Something like this: StringRegExp( $BinaryData, "(?s)\x55\x8B.." <cut> ... Okay straight to question/problem ... certain bytes that are in the range from 0x80 to 0xA0 won't match. Hmm seem to be a char encoding problem. In detail these are 27 chars: 0x80, 0x82~8C, 0x8E, 0x91~9C, 0x9E,0x9F Here's a small code snippet to explore / explain this problem: #include "StringConstants.au3" $TestData = BinaryToString("0x7E7F808182") ;Okay&
  2. Hi, Please help me to change metasymbol line. Right now I have this condition code: If StringInStr($_sName, 'TEXT ') Then $_sName = StringRegExpReplace($_sName, '(^.*)\TEXT (.*)$', '$2') $_sName = StringRegExpReplace($_sName, '(^.*)\ (.*)$', '$1') If Not CheckIsSave_($_sName) Then It work fine with this text file and finds each line which start from 'TEXT': Material B7E671143D244B ==================================== TEXT 2F3139D816C34D 1 TEXT B6A968EF2505A2 1 TEXT 35206697A04F91 1 TEXT EB485AF490D83D 1 TEXT 0DAB4
  3. I'm trying to capture everything after a "#ToDo" in my scripts. I got that like this: (?i)[^\v]*#todo(.*) But then I thought it would be nice to use underscores to continue the ToDo... kind of like this: #ToDo: This is a really long explanation about something _ # that is very in-depth and needs to take up a lot of _ # space in a ToDo comment Global $variables = "Bad" I can't seem to capture everything... and maybe I'm trying to do too much with Regex... I keep trying variations of this: Condensed Version: (?im)[^\v]*#todo(?:([^\v]*)_\s*)*#([^\v]*) Expande
  4. Inspired by PHP's preg_split. Split string by a regular expression. Also supports the same flags as the PHP equivalent. v1.0.1 Example: #include "StringRegExpSplit.au3" StringRegExpSplit('splitCamelCaseWords', '(?<=\w)(?=[A-Z])') ; ['split', 'Camel', 'Case', 'Words']
  5. Hi guys I need your help. I have string like this : "TDM111A5, RCT222Y5/ 7 ; FDT444E4 /8 , ABC222R5" I need find a coma or semicolon and delete white spaces before and after them The output should be a string and/or array String : "TDM111A5,RCT222Y5/ 7;FDT444E4 /8,ABC222R5" Array: TDM111A5 RCT222Y5/ 7 FDT444E4 /8 ABC222R5
  6. Is there a way to output the regex matches into a file? I have a script to compare two files and check for regex matches. I want to output the matching regex of 'testexample.txt' to another file. #include <MsgBoxConstants.au3> #include <Array.au3> $Read = FileReadToArray("C:\Users\admin\Documents\testexample.txt") $Dictionary = FileReadToArray("C:\Users\admin\Documents\example.txt") For $p = 0 To UBound($Dictionary) - 1 Step 1 $pattern = $Dictionary[$p] For $i = 0 To UBound($Read) - 1 Step 1 $regex = $Read[$i] If StringRegExp
  7. Im creating a code that will work in this sequence: 1. Copy the text (question) in one atea of the screen 2. Catch the 2 strings (number) 3. Multiply the 2 strings ( $1*$2) 4. Click the next area to put the answer 5. Paste the answer This is my code MouseClick($MOUSE_CLICK_LEFT, 479, 802, 3, 1) ;Clicking all of the text Send("^c") $x = StringRegExpReplace(ClipGet(), 'What is (\d*) x (\d*) \?$', "$1*$2") MouseClick($MOUSE_CLICK_LEFT, 480, 844, 1, 1) ClipPut($x) Send("^v") However the output is this $1
  8. Version 3.4


    In April 5, 2013 I ask @Lazycat he answer: Then I change this tool a little. Now I back to this and make bigger changed. Here is new version. Update History: = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 2018/11/07 v3.0 * Changed: AU3Check compilant - mLipok * Changed: almost all Variables renamed - mLipok * Added: "Delete RegExp Results" - mLipok * Added: support for dual monitor - mLipok * Added: "full screen mode" - m
  9. argh, pulling my hair out. considering this post: say for a string = "03a", how can I strip out the leading 0 and the a. I have tried: $new = StringRegExpReplace($string, '[^1-9][^0-9]', '') and various combinations: ^0+[^0-9] [^[:digit:]] "[^0].*" "^0*(d+)" I'm going loopy!
  10. Hi everyone! After updating autoit, I tried to run an old program using complex regexp's. It did not work. Eventually I broke the problem down to this example: #include <Array.au3> $buf = "First title" & @CRLF & "Tom" & Chr(0x92) & "s sleepwalking" & @CRLF & "Last | line" & @CRLF $items = StringRegExp($buf, '([\x20-\xff]+)\x0d\x0a', 3) _ArrayDisplay($items,'') And this is the result I get when running it: Row 0
  11. Hello . How to do that $regexp = starts from "abcdef" and after this could be anything in name WinActivate($regexp)
  12. Text in a file, read into var with fileread: <> <> <> <> < J please look > <> <> <> Hi, I want a RegExp to select around 'please', back to the previous < and forward to the next >. I can select the line of text. Then I add in (?s) and it selects the whole text. I think I want to make it not greedy, (?U) , that seems to make it ungreedy after, but it still selects all the previous lines. $sPattern = "(?s)<.*please.*>" ; 1 $sPattern = "(?s)<(?U).*please.*>" ; 2
  13. I want to rename every new instance of notepad to notepad(random number) If I use WinSetTitle ( "notepad", "", "notepad("&$randomnumber&")" ) this will work pretty good, because if more windows match the search entry it will take the newest. But what if this code runs, but there is no new instance of notepad. It will rename one that was already assigned a number. So I would like to check whether it is already renamed. For example by excluding titles that contain a ")". How do I do that. Read this, but that is pretty confusing: http://stackoverflow.com/questions/406
  14. #include <Array.au3> If @Compiled Then Exit Global Enum $FUNC_OUTER, $FUNC_NAME, $FUNC_PARAM, $FUNC_INNER _Example() Func _Example() Local $sIncludeDir = StringTrimRight(@AutoItExe, StringLen('AutoIt3.exe')) & 'Include\' Local $aOuterArray = _GetFunctionsToArray($sIncludeDir & 'Color.au3') If Not @error Then For $iOuter_idx = 0 To UBound($aOuterArray) - 1 _ArrayDisplay($aOuterArray[$iOuter_idx], ($aOuterArray[$iOuter_idx])[$FUNC_NAME]) Next EndIf EndFunc ;==>_Example Func _GetFunctionsToArray($sUDF_FileFullPath) Loc
  15. #include <Array.au3> ; Script Start - Add your code below here Local $test = "<li>One<li>Inner<li>Innermost</li></li></li>" & _ "<li>Two</li> " $loob = StringRegExp($test, '\Q<li>\E(.*?)\Q</li>\E', 3) _ArrayDisplay($loob, "How to return the One... and Two?") Hello, can somebody help me: (1) How can I have the regexp matched the two outermost bullets? Such that: (2) How can I match the "Innermost" bullet? Thanks so much.
  16. Hello, Have been thinking about this for a while, so decided to seek for help. I have the following string: "...<tag>1</tag>...<tag>2</tag>...<tag>3</tag>...", which I need to test if all text within <tag> matches certain criteria, e.g. it's a number "\d+". The trick is 1) I need the entire match to fail if only one instance of the text between <tag> doesn't match "\d+"; 2) I need the string to match if there's no <tag>. E.g.: - "...<tag>1</tag>...<tag>2</tag>...<tag>3</tag>..." matches. - "...<tag>
  17. Hello, I am trying to create a regExp for following HTML text: <a href="link=1">1</a> <b>2</b> <a href="link=3">3</a> | <a href="link=2">Previous</a> | <a href="link=3">Next</a>My intention is to extract href from last <a> tag. Here is my attempt: Local $reg = '(?i)\|\s?<a href="(.*?)">Next</a>' Local $text = '<a href="link=1">1</a> <b>2</b> <a href="link=3">3</a> | <a href="link=2"
  18. Hello, I want to capitalize 1st word of every sentence with StringRegExp, I am able to collect words by using this pattern: Local $reg = '(?:^|(?:[.!?]\s))(\w+)'now my problem is how can I exactly replace these words, e.g. In the following string: I only want to replace 1st "the" of the sentence with "The" but I have only words in array from RegExp, without its position in string. Thanks.
  19. Hi I am struggeling around with an RegExp I need to check a string, it should only contain digits and a - This is what i have so far StringRegExp($sColData,"[\s\D]",0)which returns true for every non-digit (\D) character including @CR (which should not exist as well) and whitespaces (\s], but it returns true even if the string contains a - which should return 0 How can i fix that, i want like "match any non-digits and whitespace characters except for a -" ? Best, Thomy
  20. Hello, Not sure if I asked the right question but how do I modify the pattern so that it only matches the second test string? $sTest1 = 'bErtrTRtrtXa' $sTest2 = 'ErtrTRtrtX' $sPattern = 'E[A-Za-z]{0,}X' Local $iResult1 = StringRegExp($sTest1, $sPattern) Local $iResult2 = StringRegExp($sTest2, $sPattern) ConsoleWrite('Test 1: ' & $iResult1 & @CRLF & 'Test 2: ' & $iResult2) Thanks!
  21. Hi all, How to get nth line text from a given text with Regexp. For example, i have a text from a window which contains 15 lines. And i need to get the text from 5th line (it may vary). How to do it. I have tried some patters like "(^ &)5" and "[^ $]{5}". But didn't work.
  22. Hi all, How to find first and last word in a sentence with Regular expression ?. Sentence is the code from SciTE. For example if sentence is; "For $i = 0 to 15" I need to extract "For from the sentence And the same way i need last word from a sentence "If Apple = 15 Then" I need "Then" from the sentence.
  23. I have constants A and B and C, in fact they are not one char but whole word and they can be included at the end of test text in parenthesis there can be only one of them but also two of them or all three separated by coma in any order (A) or (A,B ) or (C,A) or (A,B,C) or (A,C,B ) ... I need to get text in these parenthesis ; in comment at end of each line is what I want to get Test1('some text') ; '' Test1('some text (something)') ; '' Test1('some (something) text') ; '' --> ignore other () not at the end Test1('some (something) (A) text') ; '' --> I want only at end of string
  24. I'm doing parsing of HTML file with <table>. I need to go through rows and columns of table, ideally to get two dimensional array. I use this way with simple two levels of calling StrinRegExp() for rows and columns: ;~ $html = FileRead('table.html') $html = '<tr><td>r1c1</td> <td>r1c2</td></tr> <tr><td>r2c1</td> <td>r2c2</td></tr> <tr><td>r3c1</td> <td>r3c2</td></tr>' $rows = StringRegExp($html, '(?s)(?i)<tr>(.*?)</tr>', 3) For $i = 0 to UBound($rows) - 1 $row
  25. Hi all, So, I have strings where I'm trying to delimit each value, that's currently separated with spaces, with a pipe. Here are a few of the strings: "webstratauthentication\enableuserpasswordencryption.sql"02/23/2011 01:17:22 PM 1401 "12312312312312312""A" "b04ecbc4-e0e2-c14b-d780-656d348b0513" "\\nas123456n\ct40_packaging\builds\product\productname\hss\authentication\enableuserpasswordencryption.sql" "webstratauthentication\enableuserpasswordencryption.sql"02/23/2011 01:17:22 PM 1401 "" "A" "b04ecbc4-e0e2-c14b-d780-656d348b051
  • Create New...