(2) there are several 'key HOME' there, do they bring the cursor back to the start position of the CURRENT line, or the start position of the SELECTED TEXT? I don't quite understand why you have to put 'key HOME' there? (1) You mentioned that the 'not secure' macro may run into problem that the end position may not be restored correctly after replace, could you give an example to show? I tried both macro and they all ran fine in my simple example. Man, this is fast, I really appreciate your help. But most regular expression characters are inside interpreted as normal characters. Note: The asterisk * inside is interpreted always as normal character and not as regular expression character. If you want to understand the regular expressions, look into help of UltraEdit for page Regular Expressions on the table for the UltraEdit Syntax. Note: The macro property Continue if search string not found must be checked for both macro versions. The modified block in the temporary file is then cut and pasted over the still existing selection in the main file.Īfter all blocks are reformatted the new file created just for the replaces is closed without saving it. Whenever the 2 main finds select a block in the main file, it is copied via user clipboard 9 to the new file where the replaces are done.Ī replace all does not change the cursor position and therefore 1 Top after Paste is enough. If first opens a new file where all the replaces for a block are done. Key HOME is not a really good method to restore the correct end position for the selection, especially if the line below the block starts with spaces or tabs and you have configuration setting Home Key always Goto column 1 not enabled as I have. Therefore further replaces on the selection can run not on the same block and the result could be not what you would expect.Ī fast but not secure macro is following:īut if this macro works or not depends on the line below the selected block and how large the selected block is and how many bytes are inserted by every replace. The problem is that when replacing something in a selected block which modifies the number of selected bytes the end position of the selection is not correct restored after the replace. Well, now we need some regular expression replaces. Press the button Close and confirm updating the macro with Yes.Press Ctrl+V to replace the first 3 lines with the macro code copied from the browser window.Do not select the last line which contains the macro command for your configured regular expression engine. Select in the left macro code edit field the first 3 macro commands.If you see now the post macro dialog press the button Cancel. Click on Macro - Record, enter a macro name, disable the "Cancel" option, but enable the " Continue if search string not found" option and press button OK.Start UltraEdit and open your file with the data.Copy the macro code above from your browser window to Windows clipboard.To create the macro with the code above do following: It does not use a regular expression engine. Use following macro with the macro property Continue if search string not found activated for this macro. I am using a trial version of Ultraedit v13.20, in WinXP environment, line terminator is 'Default'.Īnd I prefer Ultraedit's regular expression. And the search goes on until eof.Īlso, please allow me to add additional info about my version of Uedit here: But it would be okay if the macro can convert to either the above or like (Notice that the conflict may be in here as there are indeed 2 /* */ groups within a line. Then skip 'Var1' as it's not inside any of /*. See help of UltraEdit about the Find command and the Regular expressions to understand these regular expressions.Perhaps I should restate that "I need to add a string "TC" at the end of each line between /* and */ INCLUSIVELY." Well, the 2 regex above could be also combined to a single one:įind MatchCase RegExp "%^(A ?^)01" Macro command UnixReOff sets the regular expression option to UltraEdit style. You can read in my second post at multiple files conversions help how to create a new macro and paste the following code into it.įind MatchCase RegExp "%^(AA?^)01"įind MatchCase RegExp "%^(AB?^)01"Īdd UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. The following macro solution needs the macro property Continue if a Find with Replace not found checked. See Advanced - Configuration - Search - Regular Expression Engine which engine/style you use for regular expression searches and replaces.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |