Jump to content

Search the Community

Showing results for tags 'StringRegExpReplace'.

  • 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

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. Hi folks, Thank you so much in advance for your help! I've been using AUTOIT for manipulating gcode. So far I've just worked through the excellent help examples and although I'm sure the resulting code is clumsy it has functioned However now I'm trying to improve and advance things and I've stumbled across REGEX.. and I'm a bit stuck. What I would like to be able to do is to 'move'/'transform' the gcode in a file and re-write it to a new file. I only need to move it in one direction(X). At the heart of this I need a script to extract all the X values and then ADD or SUBTRACT
  2. I often copy text from a website or pdf into a variable and once in a while pasting it back into WordPad gives weird results. It used to originate more frequently within larger Facebook texts or YouTube comments. One example from a pdf is where bullets were changed into a corner like character, etc. I assume many of these could be control characters? What is the best way to filter them out, please? From reading in the manual, my only guess was something like the following, but it seems to do nothing (not sure though, and less easy to test for me...). $text = StringRegExpReplace ( $t
  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. I am adding labour charge to total paid amount using : #include <IE.au3> #include <Array.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection ($oIE, 1) $aTableData3 = _IETableWriteToArray ($oTable) Local $sitem1 = $aTableData3[5][1] Local $sitem2 = $aTableData3[5][2] Local $lcharge = "10" ;add manualy using inputbox, becuase not generating online Local $atotPric = "Payable Total Price " Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If $oTd.Innertext = $atotPric Then $iatotPric = $oTd.Next
  5. hello sirs i've some questions about StringRegExpReplace i hope you can help me i tried to make a function that give me the host of the url and other give me the url with out host for example i've this link https://www.example.com/vb/result.php i need the first give me the example.com and the other give me /vb/result.php i find that $s_source = "https://www.google.com/vb/index.php" Local $s_Host = StringRegExpReplace($s_Source, '.*://(.*?)/.*', '\1') Local $s_Page = StringRegExpReplace($s_source, '.*://.*
  6. Hi, I would like to change the hungarian characters in a string, but I can't figure out how to do it. Help, pls. #include <MsgBoxConstants.au3> Local $sInput = "Árvíztűrő tükörfúrógép" Local $sOutput = StringRegExpReplace($sInput, "(?-i)(á)|(Á)|(é)|(É)|(í)|(Í)|(ó)|(Ó)|(ö)|(Ö)|(ő)|(Ő)|(ú)|(Ú)|(ü)|(Ü)|(ű)|(Ű)", "(?1a)(?2A)(?3e)(?4E)(?5i)(?6I)(?7o)(?8O)(?9o)(?10O)(?11o)(?12O)(?13u)(?14U)(?15u)(?16U)(?17u)(?1
  7. I need some regex help I inherited some data The data is massive and I need a clean, fast solution source is text and complex. I need to find dates such as "31-01-2018" and replace with "31-JAN-2018" Problem is that my regex "31-01-2018" takes for ever and replaces all. The ideal would be to search like this, but I am not managing \d{2}-(01)-\d{4} replace (01) with JAN But if I do it that way, the entire search string gets replaced by JAN. This is not an error, but typically regex behaviour. Any ideas? Skysnake
  8. $t = '... 1-347-318-9643 1-347-318-9647 1-347-318-9648 1-347-318-9650 1-347-318-9651 1-347-318-9652 1-347-318-9653 1-347-318-9655 1-347-318-&nbsp;...' $pattern = '347.*?318.*?9655' $tmp = StringRegExpReplace($t, $pattern, "|||", 1) ConsoleWrite($tmp & @CRLF) However i got this output: ... 1-||| 1-347-318-&nbsp;... Why i got only that, where is the other string, i thought the output should be this: ... 1-347-318-9643 1-347-318-9647 1-347-318-9648 1-347-318-9650 1-347-318-9651 1-347-318-9652 1-347-318-9653 1-||| 1-347-
  9. So I ran into this crazy "program" that cant be uninstalled via WMI, MSIExec, etc. The only way to uninstall it was from Add/Remove programs manually... Or I found if you find it in the registry under HKCU and run the uninstall string, it will also uninstall. However the string in the registry cant be run directly in a cmd window because of the format errors. It has spaces without quotations, it has invalid characters, etc, etc I know things run different when executed in the registry, so maybe there is a way I can run the regsitry key just like how the system does? If s
  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. Hi I am trying to insert line numbers in to a string with this script Func _MyInc () Static Local $i = 0 $i += 1 Return $i EndFunc Exit _InsertLines() Func _InsertLines()     $String = "A" & @CRLF & "B" & @CRLF & "C" & @CRLF & "D" $NewString =  Execute("'" & StringRegExpReplace($String,"[\r\n]*",  "' & _MyInc () & '\1" ) & "'") MsgBox (0, "", $NewString) EndFunc but I get this: 1A23B45C67D
  12. The idea to use translation api: i used the script from @mikell to build this func: Func _Translate($sFrom, $from, $to) ;thanks to mikell (autoitscript.com) ;https://www.autoitscript.com/forum/topic/182893-prompt-me-how-to-see-the-text-in-the-translation-boxhttpstranslategooglecom/?do=findComment&comment=1313423 Local $url = "https://translate.googleapis.com/translate_a/single?client=gtx" $url &= "&sl=" & $from & "&tl=" & $to & "&dt=t&q=" & $sFrom Local $oHTTP = ObjCreate("Micro
  13. I was working on something last night and decided to use StringRegExpReplace() for a config file, I never noticed that you cant just "overwrite" the file with the update so easily it required a few more pieces of code to work properly. Is this the simplest way (what I used) and while I searched for it and did not find it do we have or will we have a RegEx equivalent for _ReplaceStringInFile()? $sFile = FileRead(@ScriptDir & "\test.txt") $hFile = FileOpen(@ScriptDir & "\test.txt", 2) $sNewContent = StringRegExpReplace($sFile, "(test)", "new$1")
  14. Hallo Members, I'm looking for a good regex to get the drive letter and the last two folders from a file path, If the path is to long for the label width then show drive + ellipses and two last folders. Drive:\(ellipses)\folder\folder ex. D:\...\folder\folder and when the folder is in the root of the drive then show D:\Folder The test GUI #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: Mecano Script Function: ELLIPSIS Long path: Drive:\...\Folder\Folder if root then Drive:\Folder #ce ----
  15. 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
  16. Hi, i wrote a script that can replace multiple strings in a xml file works fine but so slow! I've used StringReplace ,_ReplaceStringInFile, StringRegExpReplace, all the same very slow,. The number of replacements in the file about 8000 Any help would be greatly appreciated #include <File.au3> $path = @ScriptDir & '\xmlfo.xml' $OXML = FileOpen($path, 256) $XML = FileRead($OXML) $term = 'post' $nofr = 1 Local $aArray = StringRegExp($XML, '(?s)<entry[^>]*>.*?</entry>', 3) FileClose($OXML) $XL = $XML If Not @error Then For $i = 0 To UBound($aArray) - 1 ;get dat
  17. Regular expressions, I hate them, seriously I have a MAC address in this format: "A2B3B56B7C3A" And I would like to change it in: "A2-B3-B5-6B-7C-3A" The MAC address can be a little longer than that one, but we are sure that the total digit number is an even number. I've tried a lot of patterns but I have not tried the right one. This is the closest one I've tried but the output shows a final hyphen (I could cut it through StringTrimLeft but I would like to do it using just RegEx). ConsoleWrite(StringRegExpReplace("A2B3B56B7C3A", "(.{2})", "$1-")) I don't understand why this patter
  18. I’m a complete newbie when it comes to using StringRegExp. Although I’ve successfully modified a couple of patterns in existing scripts, I’ve never been sure where to start in formulating a new pattern. Thus, I’ve avoided using them. But now I need to. The string I’d like to recognize and replace is of the form: prekeykey<any characters>post To put it in words, I’m looking for any occurrence of two or more consecutive key strings that are embraced by pre and post strings, regardless of any follow-on characters. The slash characters are part of the individual elements, but cou
  19. For my application, I have one string that may contain as item pointers a "space + single character/number + )" For example: Some text. 1) blah 2) blah a) yes b) no. I'd like this to become: Some text. (1) blah (2) blah (a) yes (b) no. It seems I understand the use of the back reference $1, but I may not be grasping the functionality of non-capturing groups... I hoped I could use the latter functionality so in the MAIN CODE I would not get the space between '(' and $1 The first code line below now giving me: Some text. ( 1) blah ( 2) blah ( a) yes ( b) no. Local $sOutput = StringReg
  20. I would like to replace the percentage of width div.gallery { float: left; width:20%; } I tried... $colread = "10%" $replace = StringRegExpReplace($colcss,'([0-9][^;])',$colread) This mode does not work well, can you help me to intercept the exact text between width:????????; Thanks guys
  21. Morning It's 5:30 AM and been sitting here staring at the help file but it looks like an alien language to me. I have the following example strings [8]Bird [9]Cat [10]Dog What I want is Bird Cat Dog Now a easy solution would be to just trim it to the left by 3, however there are cases when it could be 4 (example Dog being [10]), so I figured StringRegExpReplace() is what I am going to have to use unless there is a easier/better method. I don't know how or where to start though StringRegExpReplace($String, "[*]", "") Thanks
  22. Hi all i have a big amount of text files that is link this i want it to cut each part alone and the separator is bracket then number then bracket {NUM} so the first one must be i tried this #include <Array.au3> $sString=ClipGet() $sResult=StringRegExpReplace($sString,"(\{\d{1,}\})",@CR & "$1") $sResult=StringRegExpReplace($sResult,"(\r)(.*)","$2",1) ;If you want it in an array add this: $array=StringSplit($sResult,@CR) $var = 1 For $i = 1 To $array[0] FileWrite(@DesktopDir & "\sura\" & $var & ".txt" , $array[$i] & @CRLF) $var =
  23. Is it possible to left pad a matched group? Here is my situation. I am working on a program to integrate inventory from my companies warehouse with our website. Our part numbers in our Warehouse inventory look like this: 1501895, 1000973, 5000165, 6000002, etc. On our website, these same numbers would look like this: 15-1895, 1-973,5-165, 6-02 My program monitors our warehouse inventory database for changes, and when a change is made it needs to find the matching item on our website. This is the code that I originally used: StringRegExpReplace($new_items[$i][0],"([1-9]{1,2})(0*)(
  24. Hi all I get a problem with StringRegExpReplace Here is the code: $string = "< / li > < / li > < /li > < / li> < / li > </ li >" $array = StringRegExp($string, "<(.*)/(.*)(li)(.*)>", 3) _ArrayDisplay($array) I want to replace all with </li>, and the final result is: </li> </li> </li> </li> </li> </li> Please help, thanks
  25. Hello, extract text from an HTML for extracting text. Now I want to remove all html codes between < and > symbols. try to use, without success, stringRegExpReplace : $mytext = stringRegExpReplace($mytext, "\<(.*)\>", "") post here an input example <DIV style="position:absolute;top:459;left:63"><nobr><span class="miostile"><b>di ciccio formaggio</b></span></nobr></DIV> <DIV style="position:absolute;top:475;left:63"><nobr><span class="miostile"> PAVIA</span></nobr></DIV> <DIV style=
×
×
  • Create New...