Replace with the same searched word with Regexr including a new character

Asked

Viewed 33 times

1

all right? I have a question. I used the expression ( d{2}. d{2}) as image attached to search the codes of this service list.

I would like an aid so that the Replace occurred with the same searched word plus the character ; at the beginning and end.

It will be of great value a solution to this case, will help me a lot (Professional issues).

inserir a descrição da imagem aqui

1 answer

2


Place the expression in the "Replace with" box:

;$1;

The $1 represents the captured group and the characters will be added ; before and after what was captured.

An example using Javascript, but Notepad++ treats the same way:

var string = "humanos 04.19 bancos 12.34 e 13.6";
var re = new RegExp("(\\d{2}.\\d{2})", "g");
var resultado = string.replace(re , ";$1;");
console.log(resultado);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.