@kamal-lochan said in how to append the numbers with specific string ??:
Wherever Kamal string is there i wants to append some number to it .
Here is an alternative option which ONLY involves regular expressions (and the column editor function).
replace all CRLF with @@
Place cursor in the first position of the file. Using the Replace function we have
Find What:\R
Replace With:@@
Search mode is “regular expression”, click on “replace all”
insert CR & LF before every “kamal” text
Place cursor in the first position of the file. Using the Replace function we have
Find What:(([a-z]+)?kamal)
Replace With:\r\n\1
Search mode is “regular expression”, click on “replace all”
insert line numbers and move to behind the “kamal” text
Check if the first line has the “kamal” text, if not position the cursor in the first position of the second line (which does have the “kamal” text). Use column editor and use “number to insert”, starting 1, increase 1 and repeat 1, click OK.
Now to move the number behind the “kamal” text.
Using the Replace function we have
Find What:^(\d+)[a-z]+)
Replace With:\2 \1
recreate the original CRLF and remove the previously inserted ones
Using the Replace function we have
Find What:(@@)|\R
Replace With:?1(\r\n)
I’n not proposing that you use this method as it seems you are well on the way to solving it the “pythonscript” way which is far more sensible. I’m showing you another method which is very simple to understand but as a consequence has a few steps to it.
Terry