Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
krishna20
Specialist II
Specialist II

Special Characters has to be removed from Name Field

Hi Folks,

I have to remove the special characters from the name field and the below are the conditions which are need to be considered. I need the count of those errors.Please find the below sample data and advise how can i achieve this.

Error Count

At the begining and ending should not have special characters.
Inbetween first and last name should not have special character (other than .,)
There are email ID also there in the data instead of names those can be considered as Error.

not Error count

., can have in the first and last name separation.

Names
-
, Amit Agrahari
, Anuradha Iyer
, Diamond Gong
, Hemant P. Deore
, Jules Keghie
, Vishal Prasad,
. Deepan.
. Harshana
. Martijn
\Remy Alexander
21 New Interns
A D A Ratnam
A.K. Pandey
T.Uday

 

Expected Result as below

NamesFirst NameLast NameError Count
, Amit AgrahariAmitAgrahari1
, Anuradha IyerAnuradha Iyer1
, Diamond GongDiamond Gong1
, Hemant P. DeoreHemant P.Deore1
, Jules KeghieJulesKeghie1
, Vishal Prasad,VishalPrasad2
. Deepan. Deepan2
. Harshana Harshana1
\Remy AlexanderRemyAlexander1
21 New InternsNew Interns1
A D A RatnamA D ARatnam0
A.K. PandeyA.K.Pandey0
.,Uday Krishna*UdayKrishna3

 

Regards

Kalyankrishna T

1 Reply
Anil_Babu_Samineni

Perhaps this?

LOAD Names, Names1, SubField(Trim(PurgeChar(Names1,'0123456789')),' ',1) as FName, SubField(Names1,' ',-1) as LName;
LOAD Names,
If(Match(Left(Names,1),',','.','\', '*') or Match(Right(Names,1), '.', '\', ',', '*'), Trim(PurgeChar(Names,',.\*')), Names) as Names1 Inline [
Names
", Amit Agrahari"
", Anuradha Iyer"
", Diamond Gong"
", Hemant P. Deore"
", Jules Keghie"
", Vishal Prasad,"
". Deepan."
". Harshana"
". Martijn"
"\Remy Alexander"
"21 New Interns"
"A D A Ratnam"
"A.K. Pandey"
".,Uday Krishna*"
];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful