0

I have a lot of lines with mark like

/* 1 */
/* 2 */
....
/* 1000 */

I want to replace them by comma. I came up with a simple regex to use on Notepadd++

\/(.*?)\/

Works fine, but sometimes some lines has txt like this and matches the regex when should not

de produtos /  trazendo inputs qualitativos / estratégicos para a marca
------------^-------------------------------^----------------------

I am trying to use /* instead of just / but with no success!

Any suggestion?

2Fast4YouBR
  • 1,012
  • 1
  • 12
  • 22

2 Answers2

0

The following should do the work

\/\*[\d\s]+\*\/

It will match first opening comment, then either digit or space multiple times and then closing comment

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Yassin Hajaj
  • 21,337
  • 9
  • 51
  • 89
0

To be able to match /* ... */ blocks, you may use this regex:

\/\*.*?\*\/

Since * is meta-character in regex, it needs to be escaped as well.

Also it is required to use lazy quantifier .*? to avoid matching across the blocks.

anubhava
  • 761,203
  • 64
  • 569
  • 643