Jump to content

Search the Community

Showing results for tags 'StringRegExp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

  • 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

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

  1. 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
  2. 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&
  3. i am trying to get number from string using this code : #include <IE.au3> $oIE = _IEAttach ("Edu.corner") Local $aName = "Student name & Code:", $iaName = "0" Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If $oTd.InnerText = $aName Then $iaName = $oTd.NextElementSibling.InnerText $iGet = StringRegExpReplace($iaName, "\D", "") EndIf Next MsgBox(0, "", $iGet) it was get number like 52503058 But, I want to get only student code 5250. (Different student have
  4. 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
  5. So I have this pattern: ^(?:(\d+)|(\d+):(\d+)|(\d+):(\d+):(\d+))$ And I'm expecting (depending on input) to get a 1, 2 or 3 index array (or @error for invalid input). But instead I get this: #include <Debug.au3> Func Test($String) _DebugArrayDisplay(StringRegExp($String, '^(?:(\d+)|(\d+):(\d+)|(\d+):(\d+):(\d+))$', 1)) EndFunc Test('10') ; Results (normal, expected): ; Row 0|10 Test('10:20') ; Results (extra blank index): ; Row 0| ; Row 1|10 ; Row 2|20 Test('10:20:30') ; Results (three blank indices): ; Row 0| ; R
  6. Hi, I want to add any needed conditions to the StringRegExp command so it can pull out only "File.au3", "WinAPIFiles.au3", "Test.bmp" into the array #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include 'WinAPIFiles.au3' #include "File.au3" ; Script Start - Add your code below here Local $bFileInstall = False ; Change to True and ammend the file paths accordingly. ; This will install the file C:\Test.bmp to the script location. If $bFileInstall Then FileInstall("C:\Test.bmp", @ScriptDir & "\Test.bmp")
  7. i have a text : <Name>Jonh</Name>.<Age>15</Age> how i can get Jonh and 15 in one stringregexp? pls give me example
  8. 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
  9. Hello, I have spent the past day fooling with StringRegExp to no avail attempting to get what would be a simple solution to an issue using StringRegExp. I will post the code in a sec. The string 'Java x Update y' where x and y are numeric values ONLY if a letter is mixed in anywhere then it should fail. I have been able to successfully deal with the x value so if x = 1234 or a1234 or 1a234 or 1234a would result in a fail if 'a' was in the string. However, when y = 1a234 then I get an output of 1 and when y = 1234a then the output = 1234 when both should fail. I am probably overlookin
  10. Need help to make function better with full infomation #include <Array.au3> #include <File.au3> _TEST(@ScriptFullPath) _TEST("A:") _TEST("A:\B.c") _TEST("D:\E\F\") _TEST("G:\H/../J.k/") _TEST("M:\N\k..J.k") _TEST("D:\E\F\..\G\G\I..J.K.M") Func _TEST($sFilePath) Local $sDrive = "", $sFullPathDir = "", $sDirPath = "", $sDirName = "", $sFileName = "", $sFileNameExt = "", $sExtension = "", $sExt = "" Local $aPathSplit =
  11. Does anyone know how to split a string using multiple delimiters, returning both the values and delimiters withing the Array using StringRegExp? For example: ;~ Split on " Not ", " And ", " Or " $sString = ' Not $a = 1 And $b = 2 Or $b = 3' $aArray = StringRegExp($sString,...) ;~ Returned Results $aArray[0] = '$a = 1' $aArray[1] = 'And' $aArray[2] = '$b = 2' $aArray[3] = 'Or' $aArray[4] = '$b = 3' At the moment I'm using Local $aArray1 = StringRegExp($sString, '(?i) Or | And | Not ', 3)
  12. Hi, I need help string RegEx to get string from CREATE to GO #include <StringConstants.au3> ;~ Global $fileSQL1 = @ScriptDir & "\fileSQL1.sql" ;~ Global $fileSQL2 = @ScriptDir & "\fileSQL2.sql" Global $tmpSQLfile = @TempDir & "\tmpFile.sql" OnAutoItExitRegister("_OnExit") _SetTMPsql() If Not FileExists($tmpSQLfile) Then OnAutoItExitUnRegister("_OnExit") Exit MsgBox(48, "/!\", "File: " & $tmpSQLfile & @CRLF & " is not Exists!", 3) EndIf Global $ContentSQLfile
  13. Hi guys I hope you can help me out with this one. I have a text file "test.txt" which could contain something like this: __________________________________________________________ fiw eqw sdg xcv __________________________________________________________ Each string has it's own line. I use this script to find a string in the text file. In this example, the string I am looking for is "iw". The string "fiw" makes it believe that "iw" is found in the file. How can I avoid this? I want it only to return EXACT results. $string = &qu
  14. Hello, try to remove all ASCII code and keep numbers. Read about StringRegExp and its flag, but best result is this: $mytxt = "Where have all the flowers gone, long time p33 976 7 6761assing? E#a%t^ m(y) {sh}o=rt\s" MsgBox(0, "Regular Expression Replace Test", StringRegExpReplace($mytxt, "[a-z|A-Z|,|.]", "")) anyone can help me to obtain result = 3397676761 ? thank you, m.
  15. I do have a question <div class="col-sm-5 text-right"> <a href="/">IP Your adress: 113.228.141.182</a> </div> Is it true? (?U)(\d+\d+\.\d+\.\d+\.\d+.\.)
  16. hello, i'm new to this function so i need some help doing this, btw, i need to clear up my folder of work by deleting some files example file inside folder : info000001 to info999999 but i want to delete files name other than info(number) Func _delete() $dir = @ScriptDir & '\information' $cFiles = _FileListToArray($dir & '\', "*.xml", 1) If IsArray($cFiles) Then For $number To $cFiles[0] ;need to use StringRegExp here ;$stringRExp If $cFiles[$number] <> $stringRExp Then FileDelete($cFiles[$number] EndIf
  17. how can I use the StringRegEx function to extract certain lines of text from google search results in the following format: C: server port user password an example is this: C: starteam.myftp.org 18000 test1 text2 regards
  18. Hello altogether, yes I already noticed the StringRegExp AutoIt reference and the very good german tutorial of SEuBo, but nevertheless I would be pleased to get a tip. I have strings like this: 'repair car "do it your self" check' or ' repair car toyota'. There could be none, one or more words in quotation marks. It could be also that no expression is set in quotation marks (-->" "). The words of the string vary. I would like to generate an array like [repair, car, do it your self, check] or [repair, car, toyota]. Expressions in quotation marks (" ") should
  19. Hello, As always, sorry for my bad english. here is the code i have #include <File.au3> #include <String.au3> $file1 = "d:\doppioniautoit\international.txt" FileOpen($file1, 0) $file2 = "d:\doppioniautoit\standard.txt" FileOpen($file2, 0) For $i = 1 to _FileCountLines($file1) $line = FileReadLine($file1, $i) $aExtract = _StringBetween($line, "(", ")") ;MsgBox(0, $line, $aExtract[0]) $itime = TimerInit() For $x = 1 to _FileCountLines($file2) $line2 = FileReadLine($file2, $x) Local $iPosition = StringInStr($l
  20. I have code $pattern = $str = "%abcd% = Section, hardwareID_1, hardwareID_2, ..... ,HardwareID_n" $array = StringRegExp( $str, $pattern, 3)Anyone help me with $pattern value I need $array is : No whitespace in all return string . (Sorry for my English) Thank you verymuch
  21. 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"
  22. BackRef UDF Working This UDF is made to provide a small interface towards the StringRegExpReplace Autoit function. The extension is very limited but is an easy approach when used properly. Functions User can pass the complete back-reference to a function.The return value from the function is then used to replace the specific group.The final replacement is flexible and the user has full control over it.The final replacement is done automatically till modification isn't required.The optimization is easy and simple.LimitationsThe pattern has to consume the full string.Example Replace the vowels
  23. Hi, Trying to parse CSV here: https://regex101.com/r/mM2uP0/2, which gives desirable result, but SrtringRegExp output is a bit different (few empty strings have been returned): So my question would be why? And what's workaround if there's one? Thanks in advance!
  24. Good Afternoon Everyone, First and foremost, thank you for doing what you guys do. I use AutoIT almost every day. It helps the world out... so yes, thank you everyone, sincerely. This is my Regular Expression: <tr>.*(\n|\n.*\n)^<td>.*\n^<td>.*\d{1,2}\sJune\s2014.[\S\s]*?\n</tr> or <tr>.*(\n|\n.*\n)^<td>.*\n^<td>.*\d{1,2}\sMay\s2014.[\S\s]*?\n</tr> HTML CODE: </tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6296_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple
  25. $files = _FileListToArrayRec("G:\03_MUSIC\","*.mp3", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT,$FLTAR_FULLPATH) $fileArray = UBound($files)-1 For $x = 1 to $fileArray $var = FileGetTime($files[$x],0,0) $date = $var[2]& "/" & $var[1] & "/" & $var[0]&' '&$var[3]& ":" & $var[4] & ":" & $var[5] ;ConsoleWrite($files[$x]&" "&$date&@LF) ;ConsoleWrite("??? Path "&StringRegExp($files[$x],".*\\(.+)$",1)&@lf) ConsoleWrite("??? Path "&StringRegExp($files[$x],".*\\(.+)$"
×
×
  • Create New...