Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
insert into xpatjobs_area_city (area_id,type,name) values(143,'city','isola d'istria');
insert into xpatjobs_area_city (area_id,type,name) values(143,'city','d 'isria');
insert into xpatjobs_area_city (area_id,type,name) values(143,'city','ISO d'iuitria')
;
insert into xpatjobs_area_city (area_id,type,name) values(143,'city','ijuid'iskjitria');
insert into xpatjobs_area_city (area_id,type,name) values(143,'city','riad'istia');


i want to replace ' with blank i tried to replace the text using regular expsn
using text editor
([a-zA-Z])'([a-zA-Z])

but it selects a d'i for 'isola d'istria

i have a full paragraph to replace
Posted
Updated 16-Nov-12 0:02am
v2
Comments
MT_ 16-Nov-12 6:04am    
Check updated solution if it helps.

I tried this in C# and it worked fine.

C#
Regex regex = new Regex("\'");
string[] lines = File.ReadAllLines("d:\\milind.txt");
foreach (string line in lines)
{
  string str = regex.Replace(line, "");
  Console.WriteLine(str);
}


Hope that helps. If it does, mark it as answer/upvote.
I have replaced with space you can use "" if you simply want to remove '.
or
Milind
 
Share this answer
 
v3
Comments
Sanjay K. Gupta 16-Nov-12 5:55am    
+5 from me.
Nice solution.
In C#
If you want to replace the (') with blank
C#
string name=name.Replace("'","");


If you don't want to replace the (')
C#
string name=name.Replace("'","''");


In SQL
If you want to replace the (') with blank
SQL
print replace('isola d''istria','''','')
 
Share this answer
 
Comments
MT_ 16-Nov-12 5:52am    
Missed simpler way while giving solution as I got carried away by mention of regex in the OP's question :-)
Sanjay K. Gupta 16-Nov-12 5:57am    
Yes you are right but OP need some "Replace" related help. Your solution is simple and best.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900