adding comma between numbers
-
hi
how we can add comma between numbers for all lines
like this below:
“20:91BB80FB70A60DB6BFE53795BAD7EA851D8A44F212DD8A600679A835BCF7D433”=hex:3E015B4C179BC4275937EE946235EF5C“20:91BB80FB70A60DB6BFE53795BAD7EA851D8A44F212DD8A600679A835BCF7D433”=hex:3E,01,5B,4C,17,9B,C4,27,59,37,EE,94,62,35,EF,5C
-
This could work. Search for
("..:.{64}"=hex:)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)and replace with${1}${2},${3},${4},${5},${6},${7},${8},${9},${10},${11},${12},${13},${14},${15},${16},${17}. Use Regular expression search mode. It isn’t very “restrictive” on what it matches, but it could work (or you could make it more restrictive). -
Hello, @rabin-malkom, @alan-kilborn and All,
Not so hard ! I just assume that, only hexadecimal digits occur, right after the string
=hex:. My solution is shorter than Alan’s one because I’m using the very useful assertion\G;-))-
Open the Replace dialog (
Ctrl + H) -
SEARCH
(?-is)(=hex:\K|\G)..(?!$) -
REPLACE
$0, -
Tick the
Wrap aroundoption -
Select the
Regular expressionexpression mode -
Click, exclusively, on the
Replace Allbutton ( Due to the\Ksyntax you must not use theReplacebutton ! )
Notes :
-
First, the in-line modifiers :
-
Forces a non-insensitive way of searching (
(?-i)) -
Forces the regex engine to interpret the regex
.dot character as standing for a single standard char, only and notEOFchars ((?-s))
-
-
Then, the part
(=hex:\K|\G)is an alternative between2zero-length locations :-
The location right after the string
=hex:, due to the\Ksyntax, which , in addition, resets the current search -
The location right after the previous search (
\G). So, after any two hexadecimal digits, previously matched
-
-
Now, the part
..simply matches two single standard characters -
Finally, the negative look-ahead syntax
(?!$)means that the overall match occurs only if not followed with the end of the scanned line ($) -
In replacement, the
$0,syntax rewrites the overall match ( i.e. the two hexadecimal digits ), followed with a comma
Best Regards,
guy038
-
-
@guy038 said in adding comma between numbers:
because I’m using the very useful assertion
\GNice.
FYI, i’ve just tasked myself with npp-usermanual/issues/52, because the searching.md docs specifically forbid
\G(apparently, older version of boost library didn’t accept it – actually, apparently boost 1.55 also accepted\G, so the old Wiki had been out of date for a long time; fortunately, we have the framework to fix the usermanual now, unlike in the locked-wiki days :-).) -
Hi, @peterjones, and All,
It necessary to point out that, in Notepad++, the
\Gassertion, in addition to the very end of the previous search, also matches :-
The very beginning of the subject text ( obvious )
-
Any new location, deliberately created by the user, by moving the present caret location to an other one, between two clicks on the
Replacebutton, when possible !
Cheers,
guy038
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login