<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help)]]></title><description><![CDATA[<p dir="auto"><strong>The Problem:</strong><br />
I’ve used SQL to generate a single script that contains multiple jobs (over 350 in one script). I need to edit the script so that the addition of the job step uses the @job_name variable, instead of the @job_ID variable. (This is driven by my need to convert the jobs from ‘local server’ to ‘multi-server’, but that’s a whole-nother thread.) The regex I’ve constructed runs properly for the first couple iterations, then blows up, and does something “Funky”</p>
<p dir="auto"><strong>My attempt to solve the problem, and where I’m now stuck.</strong><br />
In the example code below, I want to replace “@job_id=@jobId” with “@job_name=N’TestJob1’” and ultimately do that for all jobs in the script. In my ideal world I would use a cursor, and a variable, to iterate through the script, each time I ran across the string “@job_name=” I would same the job name in a variable, and use that to update each subsequent occurrence of the string “@job_id=@jobId”, changing it to use the @job_name variable, and the job name string saved.</p>
<p dir="auto">Of course Notepad++ doesn’t have such a function (not that I’m aware of at least) and thus I’m left with regex.  I did my research and found the lookback pattern match, and I came up with the following regex expression to use on the script file. (the comment says “Pass 5” because there were 4 previous regex expressions used to strip out, and alter, other parts of the job creation script that were not going to work, or were needed special, for the multi-server job setup. Oh, and I wrote SPECIAL NOTE2 when I was optimistic that this would work)</p>
<pre><code>--- Pass 5 - replacing job_id with job_name
--- SPECIAL NOTE1: This step requires the bos ". matches newline" to be checked.
--- SPECIAL NOTE2: Retrun job until you see 0 replacements. (The script only catches one job step per run.)
(?&lt;=sp_add_job @job_name=N')(.+?)('.+?_add_jobstep @job)_id=@jobId(.+?)$
\1\2_name=N'\1'\3
</code></pre>
<pre><code>-- Sample Code snippit.
/****** Object:  Job [TestJob1]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob1', 
		@enabled=0
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...
</code></pre>
<p dir="auto">This appeared to work, albeit not perfectly. And it will work for the example above. However, in the real script (Or my test script) it falls apart after a couple runs.  On the first run, it will work perfectly, find all the  step 1’s, and update them properly. Second, third, fourth and fifth to.  Thinking I had a win, I figured I’d just have to run it multiple times; actually, around 102 times, as that’s the job with the most job steps. It sucked, I really wanted that cursor, but it was better than hand editing everything. But it was on run 6 where I hit the problem I think is being described in the article #<a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4761" rel="nofollow ugc">4761</a>.</p>
<p dir="auto">In order to help the community test, I’ve attached a test file that I generated to duplicate the problem. It contains sudo-code for 4 jobs, with varying numbers of job steps, and I did include the 102 job step example; that’ll be test-job 4. (NOTE: I did strip out all the confidential business code, and the other not-important-to-this-issue lines that SQL generated in the real script. But I did verify that the behavior still exhibits within this test file.)</p>
<p dir="auto">Therefore, if you run the regex I created above against the test file I’ve attached, what you’ll see is that on the 6th run, and every subsequent run after that,  job step 6  and above in the job “TestJob4” will incorrectly be given the “@job_name=’TestJob1’” instead of the correct “@job_name=’TestJob4’” If this is indeed the problem from article #4761, then regex is looking back all the way back to the beginning of the file, for the occurrence of the lookback match, instead of to the most current lookback match.</p>
<p dir="auto">I’m a bit stuck here, and hoping the community can throw me a life line.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22824/regex-how-can-i-get-cursor-like-behavior-from-a-regex-expression-somewhat-working-needs-help</link><generator>RSS for Node</generator><lastBuildDate>Mon, 17 Aug 2026 19:39:06 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22824.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 Apr 2022 19:53:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Wed, 13 Apr 2022 10:00:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/incrypt-_" aria-label="Profile: Incrypt-_">@<bdi>Incrypt-_</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I <strong>slightly</strong> modified my <strong>two</strong> regex S/R. So :</p>
<ul>
<li>
<p dir="auto">Regarding — Pass <strong>8</strong> – Part <strong>1</strong></p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s-i)\QEXEC msdb.dbo.sp_add_job @job_name=N'\E(\w+).+?\K^---- END_OF_JOB</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>\1$0</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">In the <strong>replacement</strong>, you can use the <strong><code>$0</code></strong> syntax wich corresponds to the <strong>complete</strong> regex match, so  the <strong>literal</strong> string <strong><code>---- END_OF_JOB</code></strong></p>
<ul>
<li>
<p dir="auto">Regarding ---- Pass <strong>8</strong> – Part <strong>2</strong></p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-is)\QEXEC msdb.dbo.sp_add_jobstep @job_\E\Kid=@jobId(?=(?s:.+?)^(\w+)---- END_OF_JOB\R)|^(\w+)---- END_OF_JOB\R</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>?2---- END_OF_JOB\r\n:name=N'\1'</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">As in the <strong>previous</strong> regex, we search for <strong><code>word</code></strong> characters ( Letters, digits and underscore <strong>only</strong>, representing the <strong>job_name</strong> ), at <strong>beginning</strong> of line(s), right before the <strong><code>---- END_OF_JOB</code></strong> string</p>
<p dir="auto">I also used the <strong><code>\K</code></strong> syntax, instead of the <strong>positive <code>look-behind</code></strong> feature. <strong>Remainder</strong> : the <strong><code>\K</code></strong> syntax means that you must, <strong>necessarily</strong>, use the <strong><code>Replace All</code></strong> button ( the <strong><code>Replace</code></strong> button won’t work ! )</p>
<hr />
<p dir="auto">Now, here is a <strong>full</strong> explanation of the provided regexes, in this <strong>last</strong> version :</p>
<ul>
<li>
<p dir="auto"><strong>First</strong> search :</p>
<ul>
<li>
<p dir="auto">At <strong>beginning</strong> the part <strong><code>(?s-i)</code></strong> are <strong>in-line</strong> modifiers which means :</p>
<ul>
<li>
<p dir="auto">The text is seen as a <strong>single</strong> line. So the <strong><code>.</code></strong> regex symbol represents <strong>any</strong> single character ( <strong>Standard</strong> <em>AND</em> <strong>EOL</strong> chars )</p>
</li>
<li>
<p dir="auto">The text must <strong>respect</strong> the <strong>case</strong> ( <strong><code>-i</code></strong> means <strong>non-insensitive</strong> search )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">Then, the part <strong><code>\QEXEC msdb.dbo.sp_add_job @job_name=N'\E</code></strong> looks for the string <strong>EXEC msdb.dbo.sp_add_job @job_name=N’</strong>, with this <strong>exact</strong> case. Everything between the <strong><code>\Q</code></strong> and <strong><code>\E</code></strong> <strong>escape</strong> sequences is simply considered as <strong>literal</strong> text !</p>
</li>
<li>
<p dir="auto">Then the part <strong><code>(\w+)</code></strong> searches for, at least, <strong>one</strong> <strong><code>word</code></strong> character ( the <strong>job_name</strong> ) and stores it as <strong>group <code>1</code></strong></p>
</li>
<li>
<p dir="auto">Finally, the part <strong><code>.+?\K^---- END_OF_JOB</code></strong> looks for the <strong>smallest</strong> range, <strong><code>.+?</code></strong>, of <strong>any</strong> char, till the string <strong><code>^---- END_OF_JOB</code></strong>, <strong>beginning</strong> a line</p>
</li>
<li>
<p dir="auto">In addition, the <strong><code>\K</code></strong> syntax <strong>cancels</strong> any <strong>previous</strong> match, so far and <strong>resets</strong> the regex engine <strong>location</strong>. So, the <strong>final</strong> match is only the <strong>literal</strong> string <strong><code>---- END_OF_JOB</code></strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>First</strong> replacement : the <strong>literal</strong> string <strong><code>^---- END_OF_JOB</code></strong> is replaced with :</p>
<ul>
<li>
<p dir="auto">The <strong>job_name</strong> ( The group <strong><code>\1</code></strong> )</p>
</li>
<li>
<p dir="auto">Then, the string <strong><code>---- END_OF_JOB</code></strong> ( <strong><code>$0</code></strong> syntax, representing the <strong>complete</strong> searched match )</p>
</li>
</ul>
</li>
</ul>
<hr />
<ul>
<li>
<p dir="auto"><strong>Second</strong> search : it contains <strong>two independant</strong> searches :</p>
<ul>
<li>
<p dir="auto">The regex search <strong><code>(?-is)\QEXEC msdb.dbo.sp_add_jobstep @job_\E\Kid=@jobId(?=(?s:.+?)^(\w+)---- END_OF_JOB\R)</code></strong></p>
</li>
<li>
<p dir="auto">The regex search <strong><code>^(\w+)---- END_OF_JOB\R</code></strong></p>
</li>
<li>
<p dir="auto">At <strong>beginning</strong> the part <strong><code>(?-is)</code></strong> are <strong>in-line</strong> modifiers which stand for each <strong>alternative</strong> and mean :</p>
<ul>
<li>
<p dir="auto">The text must <strong>respect</strong> the <strong>case</strong> ( <strong><code>-i</code></strong> means <strong>non-insensitive</strong> search )</p>
</li>
<li>
<p dir="auto">The text is <strong>not</strong> seen as a <strong>single</strong> line. So the <strong><code>.</code></strong> regex symbol represents any single <strong>standard</strong> character only ( <strong>not</strong> the <strong><code>EOL</code></strong> chars )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">Then, the part <strong><code>\QEXEC msdb.dbo.sp_add_jobstep @job_\E</code></strong> looks for the string <strong>\QEXEC msdb.dbo.sp_add_jobstep @job_\E</strong>, with this <strong>exact</strong> case. Everything between the <strong><code>\Q</code></strong> and <strong><code>\E</code></strong> <strong>escape</strong> sequences is simply considered as <strong>literal</strong> text !</p>
</li>
<li>
<p dir="auto">The <strong><code>\K</code></strong> syntax <strong>cancels</strong> any <strong>previous</strong> match, so far and <strong>resets</strong> the regex engine <strong>location</strong>. So the <strong>final</strong> match is only the <strong>literal</strong> string <strong><code>id=@jobId</code></strong>, but…</p>
</li>
<li>
<p dir="auto"><em>ONLY IF</em> a <strong>smallest</strong> range of <strong>any</strong> char ( <strong><code>?s</code></strong> modifier restricted to the <strong>non-capturing</strong> group <strong><code>(?s:.+?)</code></strong> ) till a <strong>job_name</strong>, beginning a line, followed with the string <strong><code>---- END_OF_JOB</code></strong>, with this <strong>exact</strong> case and its <strong>line-endings</strong> can be found further on, due to the <strong>look-ahead</strong> structure <strong><code>(?=(?s:.+?)^(\w+)---- END_OF_JOB\R)</code></strong></p>
</li>
<li>
<p dir="auto">The <strong>last</strong> alternative <strong><code>^(\w+)---- END_OF_JOB\R)</code></strong> simply looks for some <strong>word</strong> chars ( the <strong>job_name</strong> ), <strong>beginning</strong> a line, followed with the <strong>literal</strong> string <strong><code>---- END_OF_JOB</code></strong> and its line-endings</p>
</li>
</ul>
</li>
<li>
<p dir="auto"><strong>Second</strong> replacement : it uses a special <strong><code>Boost</code></strong> feature, called a <strong>conditional</strong> replacement :</p>
<ul>
<li>
<p dir="auto"><em>IF</em> the <strong>group <code>2</code></strong> exists ( so the <strong>second</strong> alternative ), the <strong>job_name</strong>, beginning a line and the string <strong><code>---- END_OF_JOB</code></strong>, followed with its line-endings is just replaced with the <strong>literal</strong> string <strong><code>---- END_OF_JOB</code></strong> and <strong><code>\r\n</code></strong> ( replacement part <strong>before</strong> the <strong><code>colon</code></strong> char )</p>
</li>
<li>
<p dir="auto"><em>ELSE</em> ( case of the <strong>first</strong> alternative ), the <strong>literal</strong> string <strong><code>id=@jobId</code></strong>, located <strong>after</strong> any <strong><code>EXEC msdb.dbo.sp_add_jobstep @job_</code></strong> text, is replaced with the <strong>literal</strong> string <strong><code>name=N'</code></strong>, followed with the <strong>group <code>1</code></strong> ( the <strong>job_name</strong> ) and finally a <strong><code>'</code></strong> char ( replacement part <strong>after</strong> the <strong><code>colon</code></strong> char )</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75996</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75996</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 13 Apr 2022 10:00:27 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Tue, 12 Apr 2022 23:43:17 GMT]]></title><description><![CDATA[<p dir="auto">(Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>, I just finished typing this up. Feel free to critique or provide a nuts and bolts follow-up as you may wish.)</p>
<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/incrypt-_" aria-label="Profile: incrypt-_">@<bdi>incrypt-_</bdi></a>,</p>
<p dir="auto">Nice to hear back from you, and that you were able to use a provided solution, and especially that you were able to make the necessary modification to handle details we were not aware of. (It’s not uncommon for people to come back with “It doesn’t work…”)</p>
<blockquote>
<p dir="auto">… Guys’ method, even though I still don’t quite understand the regrex phrases and logic flow. (It’s still like magic to me.)</p>
</blockquote>
<p dir="auto">I’ll try to explain.</p>
<p dir="auto">To reduce wordiness, I’ll use <em>InAccord</em> to represent “in accordance with the match requirement appropriate to the context”</p>
<p dir="auto">So, the challenge was to pick up a text1 InAccord, and plonk it down in place of some number, not known in advance, of other texts InAccord.</p>
<p dir="auto">Guy’s solution has a simple first phase that picks up text1 and plonks down a copy of it at a safe location near the end of the whole group (block, record), ie, past all the locations where we wish to make replacements with that text1.</p>
<p dir="auto">Now a second phase runs which tries to match a to-replace piece InAccord, skip past some in-between text, and then match and capture the text1 copy (also InAccord) parked near the end. Upon a full match, the regex plonks down text1 (with some fixed text) that achieves the desired substitution.</p>
<p dir="auto">The magic is that only the to-replace piece is consumed by the regex scanner. The other texts are matched and captured from within a “lookahead” directive so they’re visited but not consumed. This enables the regex, after doing that little match &amp; replace job, to continue its hunt from just past the freshly written text, <em>not</em> from the end of the record (even though the end of the record was visited).</p>
<p dir="auto">There’s also another bit of magic where each failure to match a to-replace text causes (using regex <em>alternate</em>) a check for a match of record end, and if found, causes (using regex <em>conditional capture group existence test</em>) a clean out of the temporary text1.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75992</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75992</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Tue, 12 Apr 2022 23:43:17 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Tue, 12 Apr 2022 23:04:19 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/incrypt-_" aria-label="Profile: Incrypt-_">@<bdi>Incrypt-_</bdi></a>,</p>
<p dir="auto">Would you like some <strong>information</strong> regarding the <strong>two</strong> regex S/R that I provided to you ?</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75991</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75991</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 12 Apr 2022 23:04:19 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Tue, 12 Apr 2022 20:59:26 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Peter,</strong><br />
The guys got the gist of my question for sure. Though I would have jumped at the chance to use a python snap in Notepad++, I’m in a locked-down environment, and though I’m provided Notepad++ and SSMS as tools to use, such snap-in’s need to be pre-authorized before they are permitted, and that is a long an onerous process, I’m sorry to say.  (You have no idea what I had to go through just to get the COMPARE snap in loaded.)</p>
<p dir="auto">As for getting regex help, I may have a brown belt in regex, or maybe not even that, but when I hit what looked like a regex bug, I knew I needed the help of the masters. And boy, did the masters step up!</p>
<p dir="auto">=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=</p>
<p dir="auto"><strong>Niel, Guy,</strong><br />
Thank you both for your responses. When I verified them, both methods worked on my test file. So both answers are valid for the question as I posed it.</p>
<p dir="auto">Niel, Your answer was more intuitive to me. Most likely because it was closest to what I already understood. But in the end, I decided to go with Guys’ method, even though I still don’t quite understand the regrex phrases and logic flow. (It’s still like magic to me.)</p>
<p dir="auto">Both of you had used the “GO” statement as an “End of Job” flag for the regex expression. And though valid for the test file I had created, there was an edge case it ran afoul of; In the code that I had sanitized out of the test file, I had removed the JOB command syntax – the Stuff that SQL actually executes when the job is run. Unfortunately, in that syntax a couple of job steps had legal “GO” statements as part of the job command.  Which of course broke things.</p>
<p dir="auto">My solution was to add my own “---- END OF JOB” marker, and then use Guy’s method to replace the Job_ID’s with Job_Names. That was for two reasons, 1) it didn’t’ require the creation and running of a macro (Thus remaining inside the paradigm of regex expressions only). And 2) It seemed that guys approach was less prone to potential corruption, as it was a run once. Not a run macro over a hundred times).</p>
<p dir="auto">Again, thank you both for your contributions. I learned a lot more about regex from this exorcise, getting me just that much closer to my Regex-Black-Belt.  😉</p>
<p dir="auto">Oh, and to give back to the community.<br />
This is the regex algorithm I developed to try and convert SQL jobs that you use the native job scripting tools within SSMS to generate, and convert that SQL Job script file from one that makes Local SQL Server jobs, to one that makes Multi-Server SQL jobs, which in turn can be run on the master server who will publish down to the target servers. It’s a “Use at your own risk” type algorithm, but for anyone finding themselves in a similar situation to mine, it may help you navigate the conversion just that much more easy….<br />
— InCyrpt</p>
<pre><code>--================================
--- Generte a single script of all SQL jobs you want to port over from a LOCAL server job set up
--- over to a multi-server setup. I did this using the Object Explorer method described in this 
--- article http://www.sqlcircuit.com/2013/08/how-to-script-all-sql-agent-jobs-in.html
--================================
-- Creating delete script
--  I prefer to mae a seperate drop and create set of scripts. 
--  So for this regex, all the drop job statements from the source script into their own script
--   Then run:
SEARCH:  (^.+?Object:\h+job\h+\[)(.+?)(\].+?\r\n.+?@job_)ID=N'.+?'(,.+?$)
REPLACE: \1\2\3Name=N'\2'\4
--================================
--- Mkaing the migration script. 
--  First, copy all the CREATE JOB statements into thier own script. 
--- The following set of regex experssions are predicated on ther eonly being ADD_JOB and UPDATE_job statements
--  in the script.
--  The following regex expressions are then used, in sequence, to massage the script from a single-server
--  to a multi-server script
--================================
-- Pass 1 - Regex for changing Job owner
SEARCH:  (^.+?@owner_login_name=N')(.+?)('.+?$)
REPLACE: \1&lt;YourDomainSQLUser&gt;\3
--================================
--- Pass 2 - Configuring job for Multi-Server operator 
--- (MSXOperator is the ONLY operator that can be used. https://www.sqlshack.com/multiserver-administration-master-target-sql-agent-jobs/)
SEARCH:  (@notify_email_operator_name=N'|@notify_page_operator_name=N')(.+?)('.*?$)
REPLACE: \1MSXOperator\3
--================================'
--- Pass 3 - Stripping out the IF statements
--- SPECIAL NOTE1: Run this replace as "Normal" and NOT a REGEX search.
SEARCH:  IF (@@ERROR &lt;&gt; 0 OR @ReturnCode &lt;&gt; 0) GOTO QuitWithRollback
REPLACE: *** Replace With = Empty String ***
--================================
--- Pass 4 - Stripping out the @ReturnCode
SEARCH:  ^EXEC\h+@ReturnCode\h+=\h+msdb
REPLACE: EXEC msdb
--================================
--- Pass 5 - Setting the Job type
SEARCH:  (@category_name=N')(.+?)('.*?)$
REPLACE: \1[Uncategorized \(Multi-Server\)]\3
--================================
----- Stripping out the Transaction logic:
--- Pass 6a - Strpping out the headder
---    After running this statement, manually cut-n-paste 
---    the first occurance  of "---- END_OF_JOB" to the end of the last job in the script.
SEARCH:  (?s)(^/\*\*\*\*\*\*\h+Object:\h+Job\h+.+?$)(.+?)(EXEC\h+msdb.dbo.sp_add_job\h+@job_name.+?$)
REPLACE: ---- END_OF_JOB\r\n\1\r\n\3	

--- Pass 6b - Stripping out the footer
SEARCH:  (?s)^EXEC msdb.dbo.sp_update_job.+?EndSave:$
REPLACE: *** Replace With = Empty String ***
--================================
--- Pass 7 - Cleaning up servers settings
--- NOTE - Run as normal search.
SEARCH:  , @job_id = @jobId OUTPUT
REPLACE: *** Replace With = Empty String ***
--================================
--- Pass 8 - replacing job_id with job_name
-- Part 1
SEARCH:  (?s-i)\QEXEC msdb.dbo.sp_add_job @job_name=N'\E(.+?)'.+?\K---- END_OF_JOB
REPLACE: \1---- END_OF_JOB

--- part 2
SEARCH:  (?-is)(?&lt;=\QEXEC msdb.dbo.sp_add_jobstep @job_\E)id=@jobId(?=(?s:.+?)^(.+)---- END_OF_JOB\R)|^(.+)---- END_OF_JOB\R
REPLACE: ?2---- END_OF_JOB\r\n:name=N'\1'
--================================
--- Pass 9 - adding in the Multi-Server element to the end of the job creating script.
SEARCH:  (?s)(EXEC msdb.dbo.sp_add_job\h+@job_Name=N')(.+?)('.+?)(?=---- END_OF_JOB)
REPLACE: \1\2\3EXEC msdb.dbo.sp_add_jobserver @job_name=N'\2', @server_name = N'TestServer_1'\r\nGO\r\nEXEC msdb.dbo.sp_add_jobserver @job_name=N'\2', @server_name = N'TestServer_2'\r\nGO\r\nEXEC msdb.dbo.sp_add_jobserver @job_name=N'\2', @server_name = N'TestServer_3'\r\nGO\r\nPRINT '----- Ending of job \2'\r\n
--================================

--================================
--- Adding the new Is Active Node testing step to each job.
--- on the master job server Run the script SEI_PUB_sp_AddAGPrimaryCheckStepToAgentJob.sql
--- Get either the delete or create script, and use the folloiwng regex to do a "Find all in doc"
SEARCH:  (^/\*\*\*\*\*\*\h+Object:\h+Job\h+.+?$)
--- Copy the capured results into a new text file.
--- use the following regex to generate the EXEC calls to sp_AddAGPrimaryCheckStepToAgentJob
SEARCH:  (.+?^/\*\*\*\*\*\*\h+Object:\h+Job\h+\[)(.+?)(\].+?$)
REPLACE: EXEC  sp_AddAGPrimaryCheckStepToAgentJob '\2'\r\nGO\r\n
--================================
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/75987</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75987</guid><dc:creator><![CDATA[InCrypt _]]></dc:creator><pubDate>Tue, 12 Apr 2022 20:59:26 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Mon, 11 Apr 2022 13:22:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> said in <a href="/post/75904">REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help)</a>:</p>
<blockquote>
<p dir="auto">a job for programming, not for regex</p>
</blockquote>
<p dir="auto">Based on the answers that Neil and Guy provided, I guess I misunderstood the original question – I thought the original problem had the replacement changing each time through… sorry for the bad advice.</p>
<p dir="auto">(Still, if it were my data that I was trying to manipulate, I think writing a script would have been faster for me than trying to figure out a regex that was safe to run multiple times to get the same result.  But convincing someone else to write the regex for you is much less effort, I will agree.)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75940</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75940</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 11 Apr 2022 13:22:29 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Mon, 11 Apr 2022 09:48:25 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/incrypt-_" aria-label="Profile: incrypt-_">@<bdi>incrypt-_</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> and *<strong>All</strong>,</p>
<p dir="auto">And here is the <strong>expected</strong> result :</p>
<pre><code class="language-diff">----------- Begin Job Step Name testing --------------



/****** Object:  Job [TestJob1]    Script Date: 4/5/2022 12:31:53 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob1', 
		@enabled=0
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...





GO

/****** Object:  Job [TestJob2]    Script Date: 4/5/2022 12:31:54 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob2', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob2', @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob2', @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob2', @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...





GO

/****** Object:  Job [TestJob3]    Script Date: 4/5/2022 12:31:54 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob3', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...





GO
/****** Object:  Job [TestJob4]    Script Date: 4/5/2022 12:32:14 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob4', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_6]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_6', 
		@step_id=6, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_7]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_7', 
		@step_id=7, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_8]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_8', 
		@step_id=8, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_9]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_9', 
		@step_id=9, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_10]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_10', 
		@step_id=10, 
--...
--12 - 14 Rows of job step info
-- ...



/****** Object:  Step [TestJobStep_100]    Script Date: 4/5/2022 12:32:18 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_100', 
		@step_id=100, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_101]    Script Date: 4/5/2022 12:32:18 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_101', 
		@step_id=101, 
--...
--12 - 14 Rows of job step info
-- ...


GO
</code></pre>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75933</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75933</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 11 Apr 2022 09:48:25 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Wed, 13 Apr 2022 07:25:47 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/incrypt-_" aria-label="Profile: incrypt-_">@<bdi>incrypt-_</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> and *<strong>All</strong>,</p>
<p dir="auto">I found out a way to avoid all the <strong>successive</strong> passes, hitting the <strong><code>Replace All</code></strong> <strong>repeatedly</strong>, untill the message <strong>No occurrence…</strong> !</p>
<p dir="auto">So, starting with this <em>INPUT</em> file, below :</p>
<pre><code class="language-diff">----------- Begin Job Step Name testing --------------



/****** Object:  Job [TestJob1]    Script Date: 4/5/2022 12:31:53 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob1', 
		@enabled=0
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...





GO

/****** Object:  Job [TestJob2]    Script Date: 4/5/2022 12:31:54 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob2', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...





GO

/****** Object:  Job [TestJob3]    Script Date: 4/5/2022 12:31:54 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob3', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...





GO
/****** Object:  Job [TestJob4]    Script Date: 4/5/2022 12:32:14 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob4', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_6]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_6', 
		@step_id=6, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_7]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_7', 
		@step_id=7, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_8]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_8', 
		@step_id=8, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_9]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_9', 
		@step_id=9, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_10]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_10', 
		@step_id=10, 
--...
--12 - 14 Rows of job step info
-- ...



/****** Object:  Step [TestJobStep_100]    Script Date: 4/5/2022 12:32:18 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_100', 
		@step_id=100, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_101]    Script Date: 4/5/2022 12:32:18 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_101', 
		@step_id=101, 
--...
--12 - 14 Rows of job step info
-- ...


GO
</code></pre>
<p dir="auto">I use a <strong>first</strong> regex S/R  which rewrites the <strong>corresponding</strong> <strong><code>job_name</code></strong> <strong>right before</strong> any word <strong><code>GO</code></strong></p>
<ul>
<li>
<p dir="auto">Move to the line <strong><code>----------- Begin Job Step Name testing --------------</code></strong> of your file</p>
</li>
<li>
<p dir="auto">Open the <strong>Replace</strong> dialog ( <strong><code>Ctrl + H</code></strong> )</p>
</li>
<li>
<p dir="auto">SEARCH <strong><code>(?s-i)\QEXEC msdb.dbo.sp_add_job @job_name=N'\E(\w+).+?\K^GO</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>\1GO</code></strong></p>
</li>
<li>
<p dir="auto">Untick <strong>all</strong> box options</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular exoression</code></strong> search <strong>mode</strong></p>
</li>
<li>
<p dir="auto">Click, <strong>once</strong> only, on the <strong><code>Replace All</code></strong> button ( Do <strong>not</strong> use the <strong><code>Replace</code></strong> button ! )</p>
</li>
</ul>
<p dir="auto">You should obtain this <strong>temporary</strong> layout, below :</p>
<pre><code class="language-diff">----------- Begin Job Step Name testing --------------



/****** Object:  Job [TestJob1]    Script Date: 4/5/2022 12:31:53 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob1', 
		@enabled=0
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...





TestJob1GO

/****** Object:  Job [TestJob2]    Script Date: 4/5/2022 12:31:54 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob2', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...





TestJob2GO

/****** Object:  Job [TestJob3]    Script Date: 4/5/2022 12:31:54 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob3', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...





TestJob3GO
/****** Object:  Job [TestJob4]    Script Date: 4/5/2022 12:32:14 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob4', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_6]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_6', 
		@step_id=6, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_7]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_7', 
		@step_id=7, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_8]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_8', 
		@step_id=8, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_9]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_9', 
		@step_id=9, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_10]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_10', 
		@step_id=10, 
--...
--12 - 14 Rows of job step info
-- ...



/****** Object:  Step [TestJobStep_100]    Script Date: 4/5/2022 12:32:18 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_100', 
		@step_id=100, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_101]    Script Date: 4/5/2022 12:32:18 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_101', 
		@step_id=101, 
--...
--12 - 14 Rows of job step info
-- ...


TestJob4GO
</code></pre>
<hr />
<p dir="auto">Then, I use a <strong>second</strong> regex S/R which will change any <strong><code>@job_id=@jobId</code></strong> string with the string <strong><code>@job_name=N'JOB'</code></strong> where <strong><code>JOB</code></strong> represents the <strong>corresponding</strong> <strong><code>Job_Name</code></strong>, in <strong>one</strong> go, only !</p>
<p dir="auto">In addition it will <strong>delete</strong> the temporary <strong><code>Job_Name</code></strong> added in front of any <strong><code>GO</code></strong> string</p>
<ul>
<li>
<p dir="auto">Open the <strong>Replace</strong> dialog ( <strong><code>Ctrl + H</code></strong> )</p>
</li>
<li>
<p dir="auto">SEARCH <strong><code>(?-is)(?&lt;=\QEXEC msdb.dbo.sp_add_jobstep @job_\E)id=@jobId(?=(?s:.+?)^(.+)GO\R)|^(.+)GO\R</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>?2GO\r\n:name=N'\1'</code></strong></p>
</li>
<li>
<p dir="auto">Untick <strong>all</strong> box options</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> search <strong>mode</strong></p>
</li>
<li>
<p dir="auto">Click <strong>once</strong> only on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
<p dir="auto">=&gt; In the <strong>next</strong> post, You’ll see the <strong>expected</strong> <em>OUTPUT</em> text :</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75932</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75932</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 13 Apr 2022 07:25:47 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Mon, 11 Apr 2022 03:32:38 GMT]]></title><description><![CDATA[<p dir="auto">A slightly more refined version:</p>
<p dir="auto">Fi: <code>(?s)(?&lt;=^\QEXEC msdb.dbo.sp_add_job @job_name=N'\E)(\w+)((?:(?!\r\nGO).)*?)@job_id=@jobId</code><br />
Re: <code>\1\2@job_name=N'\1'</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75928</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75928</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Mon, 11 Apr 2022 03:32:38 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Mon, 11 Apr 2022 03:07:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/incrypt-_" aria-label="Profile: incrypt-_">@<bdi>incrypt-_</bdi></a></p>
<p dir="auto">Hi. I believe I have a solution.</p>
<p dir="auto">First off, for development purposes, I condensed the data you provided, maintaining the crucial elements while making it much less painful to work with:</p>
<pre><code>USE [msdb]
GO
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob1',h		@enabled=0
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1',h		@step_id=1, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2',h		@step_id=2, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3',h		@step_id=3, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4',h		@step_id=4, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5',h		@step_id=5, 
GO
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob2',h		@enabled=1
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1',h		@step_id=1, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2',h		@step_id=2, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3',h		@step_id=3, 
GO
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob3',h		@enabled=1
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1',h		@step_id=1, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2',h		@step_id=2, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3',h		@step_id=3, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4',h		@step_id=4, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5',h		@step_id=5, 
GO
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob4',h		@enabled=1
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1',h		@step_id=1, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2',h		@step_id=2, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3',h		@step_id=3, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4',h		@step_id=4, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5',h		@step_id=5, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_6',h		@step_id=6, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_7',h		@step_id=7, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_8',h		@step_id=8, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_9',h		@step_id=9, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_10',h		@step_id=10, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_100',h		@step_id=100, 
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_101',h		@step_id=101, 
GO
</code></pre>
<p dir="auto">I developed this regex:</p>
<p dir="auto">Fi: <code>(?s)(?&lt;=^\QEXEC msdb.dbo.sp_add_job \E)(@job_name=N')(\w+)((?:(?!\r\nGO).)*?)@job_id=@jobId</code><br />
Re: <code>\1\2\3@job_name=N'\2'</code></p>
<p dir="auto">which produces this output:</p>
<pre><code>USE [msdb]
GO
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob1',h		@enabled=0
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_1',h		@step_id=1, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_2',h		@step_id=2, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_3',h		@step_id=3, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_4',h		@step_id=4, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob1', @step_name=N'TestJobStep_5',h		@step_id=5, 
GO
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob2',h		@enabled=1
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob2', @step_name=N'TestJobStep_1',h		@step_id=1, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob2', @step_name=N'TestJobStep_2',h		@step_id=2, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob2', @step_name=N'TestJobStep_3',h		@step_id=3, 
GO
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob3',h		@enabled=1
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_1',h		@step_id=1, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_2',h		@step_id=2, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_3',h		@step_id=3, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_4',h		@step_id=4, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob3', @step_name=N'TestJobStep_5',h		@step_id=5, 
GO
EXEC msdb.dbo.sp_add_job @job_name=N'TestJob4',h		@enabled=1
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_1',h		@step_id=1, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_2',h		@step_id=2, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_3',h		@step_id=3, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_4',h		@step_id=4, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_5',h		@step_id=5, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_6',h		@step_id=6, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_7',h		@step_id=7, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_8',h		@step_id=8, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_9',h		@step_id=9, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_10',h		@step_id=10, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_100',h		@step_id=100, 
EXEC msdb.dbo.sp_add_jobstep @job_name=N'TestJob4', @step_name=N'TestJobStep_101',h		@step_id=101, 
GO
</code></pre>
<p dir="auto">The regex does the same required work on the messy real world data as on my condensed data.</p>
<p dir="auto">Note that it assumes line endings are <code>CRLF</code>; you can use the backward P (“Show all characters”) toolbar button, or menu item <code>View -&gt; Show Symbol -&gt; Show all chars</code>, to confirm. If it deviates, an adjustment will be needed.</p>
<p dir="auto">Each press of ReplAll operates on the next row in each section. Once all rows within a section are done, that section won’t be touched, as one would hope. After the section with the largest number of rows is done, successive presses do nothing, again as one would hope.</p>
<p dir="auto">The main difference with the one you developed (which got you pretty close) was adding a means to abandon the active hunt when it bumps into a reliable end-of-section marker, which I took to be a newline followed by GO.</p>
<p dir="auto">If you want to be able to convert a loaded file with one action, start a macro recording, and:</p>
<ul>
<li>move caret to file home</li>
<li>invoke (ctl-h) and set up the Replace dialog: paste in the F &amp; R expressions, make settings appropriate</li>
<li>do one “Replace All”, Close</li>
</ul>
<p dir="auto">Stop macro recording.</p>
<p dir="auto">Now, you can “Run a macro multiple times…”; for your test data, the needed number for obvious reasons was 12, but entering 100 causes no harm. Adjust as needed for your actual target data. (The “Run until end of file” option won’t do the whole job, I found.)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75927</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75927</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Mon, 11 Apr 2022 03:07:34 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Sat, 09 Apr 2022 22:12:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/incrypt-_" aria-label="Profile: incrypt-_">@<bdi>incrypt-_</bdi></a> said in <a href="/post/75880">REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help)</a>:</p>
<blockquote>
<p dir="auto">I’m a bit stuck here, and hoping the community can throw me a life line.</p>
</blockquote>
<p dir="auto">What you’ve described is a job for programming, not for regex.  If you want, you could use the PythonScript plugin inside Notepad++ to give your program (script) direct access to the contents of the Notepad++ editor from a python script that you would have to write to solve the problem.</p>
<blockquote>
<p dir="auto">Test File (I can’t upload yet)</p>
</blockquote>
<p dir="auto">“yet” is a misnomer.  The forum doesn’t have generic file storage.  It allows you to paste an image into the post, but you cannot attach any other kind of file.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75904</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75904</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 09 Apr 2022 22:12:00 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX: How can I get cursor like behavior from a regex expression? (Somewhat working needs help) on Fri, 08 Apr 2022 20:00:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/incrypt-_" aria-label="Profile: incrypt-_">@<bdi>incrypt-_</bdi></a></p>
<hr />
<p dir="auto">Test File (I can’t upload yet) Also, from TestJob4 I clipped out steps 11 - 99 just to save space.</p>
<pre><code>USE [msdb]
GO
----------- Begin Job Step Name testing --------------



/****** Object:  Job [TestJob1]    Script Date: 4/5/2022 12:31:53 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob1', 
		@enabled=0
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:31:53 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...





GO

/****** Object:  Job [TestJob2]    Script Date: 4/5/2022 12:31:54 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob2', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...





GO

/****** Object:  Job [TestJob3]    Script Date: 4/5/2022 12:31:54 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob3', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:31:54 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...





GO
/****** Object:  Job [TestJob4]    Script Date: 4/5/2022 12:32:14 PM ******/

EXEC msdb.dbo.sp_add_job @job_name=N'TestJob4', 
		@enabled=1
--...
--12 - 14 Rows of job Config info
-- ...
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_1', 
		@step_id=1, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_2]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_2', 
		@step_id=2, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_3]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_3', 
		@step_id=3, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_4]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_4', 
		@step_id=4, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_5]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_5', 
		@step_id=5, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_6]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_6', 
		@step_id=6, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_7]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_7', 
		@step_id=7, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_8]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_8', 
		@step_id=8, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_9]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_9', 
		@step_id=9, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_10]    Script Date: 4/5/2022 12:32:15 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_10', 
		@step_id=10, 
--...
--12 - 14 Rows of job step info
-- ...



/****** Object:  Step [TestJobStep_100]    Script Date: 4/5/2022 12:32:18 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_100', 
		@step_id=100, 
--...
--12 - 14 Rows of job step info
-- ...


/****** Object:  Step [TestJobStep_101]    Script Date: 4/5/2022 12:32:18 PM ******/
EXEC msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'TestJobStep_101', 
		@step_id=101, 
--...
--12 - 14 Rows of job step info
-- ...


GO
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/75881</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75881</guid><dc:creator><![CDATA[InCrypt _]]></dc:creator><pubDate>Fri, 08 Apr 2022 20:00:27 GMT</pubDate></item></channel></rss>