Given the below string
Declare @string varchar(max)=\'abc ___________ deffns ___ cg _ hif _______hh ihs\';
this is the Output requi
First get rid of the multiple underscores, then do the replace.
Here is one method:
select replace(replace(replace(@string, '_', '><'
), '<>', ''
), '><', 'LASTNAME'
)
In C# you can use:
string str = Regex.Replace(s, @"(_)\1{5,}", Lastname);
It will match character _ if more than 5 _ occurs.