Here is a small example of what I am trying to do...
--*********
declare @String varchar(300)
set @String = 'here is my phone number 1234567890. but my cell is 4444444444, and my work number is 5555555555. i said my my phone number 1234567890. and my cell is 4444444444, and my work number is 5555555555. '
select @String
While patindex('%1234[0-9][0-9][0-9][0-9][0-9][0-9]%',@String) > 0
BEGIN
Set @String = STUFF(@String,patindex('%1234[0-9][0-9][0-9][0-9][0-9][0-9]%',@String)+4,6,REPLICATE('x',6))
select @String
End
While patindex('%4444[0-9][0-9][0-9][0-9][0-9][0-9]%',@String) > 0
BEGIN
Set @String = STUFF(@String,patindex('%1234[0-9][0-9][0-9][0-9][0-9][0-9]%',@String)+6,6,REPLICATE('x',6))
select @String
End
select @String
--**********
i want to mask the phone number... but i also dont want to have the second while loop as there could be many occurances of area codes (eg. 1234, 4444), so i wanted to see if anyone knew how to do a pattern with a logical OR (OR |) in it, to remove the second While loop??
patindex('%1234|4444[0-9][0-9][0-9][0-9][0-9][0-9]%',@String)
Thanks for the other example, but thats not what I am looking for...