Home > Blockchain >  Regexp regular/recursive find/replace in Notepad
Regexp regular/recursive find/replace in Notepad

Time:04-30

How to split some strings defined in a specific format:

[length namevalue field]name=value[length namevalue field]name=value[length namevalue field]name=value[length namevalue field]name=value

Is it possible with a Find/Replace regex in Notepad isolate the pair name=value replacing [length namevalue field] with a white space? The main problem is related to numeric value where a simple \d{4} search doesn't work.


Eg.

INPUT:

0010name=mario0013surname=rossi0006age=180006phone=0014address=street
0013name=marianna0013surname=rossi0006age=210006phone=0015address=street1
0003name=pia0015surname=rossini0005age=30017phone= 39221122330020address=streetstreet

OUTPUT:

name=mario surname=rossi age=18 phone= address=street
name=mario surname=rossi age=18 phone= address=street
name=marianna surname=rossi age=21 phone= address=street1
name=pia surname=rossini age=3 phone= 3922112233 address=streetstreet

CodePudding user response:

You can use

\d{4}(?=[[:alpha:]]\w*=)
\d{4}(?=[^\W\d]\w*=)

See the enter image description here

  • Related