Reputation: 85
I have application where few labels are written like
ui-label-Display Not Masked
Now I want to replace it by
ui-label-Display_Not_Masked
so i have written search regex by
ui-label-(\w+ )*
This searches all expression but I am not able to create a expression to replace this text as required. I have written one regex
$1_
which replaces
ui-label-Display Not Masked
by
ui-label-Display Not_Masked
Upvotes: 1
Views: 2588
Reputation: 43296
This cannot be done with a single regex in a single iteration. You have two choices:
(ui-label-\w+)
(note the space at the end) with $1_
until it no longer matches anything.(ui-label-\w+) (?:(\w+)(?: (\w+))?)?
and replace with $1_$2_$3
.Upvotes: 2