We just search the zero length string ^ ( beginning of line ) if it’s followed with the string 1\r\n, preceded by 4 spacesįor the second S/R, I had to consider any bloc between the 1 line and the … line. SEARCH ^(?=\h*1\r\n ( is preceded by four spaces ) If you don’t have any indentation, just remove the four spaces, in the replacement part of the FIRST S/R, belowįor the first S/R, I suggest that very simple regex : Indeed, she’s quite right about a possible indentation ! Therefore, I will rely on the code alignment, proposed by Claudia, for the regexes below ! Secondly, if a … line is found, in a block, move it, upwards, before the 1 lineĪs I saw the new Claudia’s post, I, then, updated this post. Well, I, finally, found the right regexes ! I say regexes ( and not regex ) because it’s more simple to split your problem, in two consecutive actions, as you described, in your first post :įirstly, add the line 1, before each line The SECOND link explains the syntax, of regular expressions, in the REPLACEMENT part The FIRST link explains the syntax, of regular expressions, in the SEARCH part Juan, You’ll find good documentation, about the new Boost C Regex library ( similar to the PERL Regular Common Expressions ) used by Notepad , since the 6.0 version, at the TWO addresses below : Secondly, the line 1 with its EOL => 1\r\nįourthly, the group 2 => \2 ( All the initial lines bewteen the one and the one ) Therefore the modifier (?-s), at the end of the regex, means that the dot represents, as usual, any standard character, onlyĪnd, in replacement, we have to re-write :įirstly, the group 3 => \3 ( the … line ) The modifier (?s) means that the dot can be either a standard or an end of line character It’s referenced as group 2, as surrounded, too, with round brackets The middle part (?s)(.*?) represents the smallest range of standard or EOL characters, in one or several complete lines, between the two lines, described above. The final part (?-s)(.*\R) represents the complete line …, with its EOL, and it’s referenced as group 3, as surrounded with round brackets The first part ^(, with its EOL characters, and it’s referenced as group 1, as surrounded with round brackets In addition, this S/R doesn’t care about the number of lines, even zero, which may occur between the line and the … line !īut, of course, in all cases, the … line must be located AFTER the line !!Ĭheck the Wrap around option, if necessaryĬheck the Regular expression search mode ( Important ) I think that I found a S/R which can process the two operations, at the same time. The end result should look like:Īny guidance on how I can do this on my own using Notepad would be great. This element and data should be positioned above quantity. I apologize if I have not identified the parts of the XML file that need to be modified.įirst I need to insert a new element with data “1” above the element with the data to a new position. I searched quite a bit for threads on two things but could not find anything.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |