6

I have a string representing hex numbers, like this:

778206213082061D06092A

I want to get a string like this:

0x77, 0x82, 0x06, 0x21, 0x30, 0x82, 0x06, 0x1D, 0x06, 0x09, 0x2A

So every 2 characters, I want to insert , 0x Is this doable with Notepad++?

Toto
  • 89,455
  • 62
  • 89
  • 125
tzippy
  • 6,458
  • 30
  • 82
  • 151

3 Answers3

18

Try this:

Find:

(..)

Replace:

0x\1, 

The find expression (..) matches any two characters (dot matches anything), and the parenthesis allow us to capture those two characters. We can then replace with the hex expression, accessing those two captured characters by using \1 (or $1; Notepad++ will accept either). Note that there is a space after the comma in the replacement.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
3

How about:

  • Ctrl+H
  • Find what: (..)
  • Replace with: 0x$1,
  • Replace all

You have then to remove the last , if requested.

Toto
  • 89,455
  • 62
  • 89
  • 125
0
  1. Ctrl+H for Find & Replace
  2. Tick Regular Expression
  3. Find: ([A-Z0-9]{2}) & replace with 0x\1, (space on the end)
  4. Find: , $ & replace with nothing. (to remove trailing ,)
Alex K.
  • 171,639
  • 30
  • 264
  • 288