Ex1: Str=Henry D. RICH
here first name=Henry
Middle name=D.
Last Name=RICH
output=Henry D. RICH
Ex2: Str=.Jason Kumar F. Reddy
Here first name=.Jason Kumar
middle name=F.
last name=Reddy
output=.Jason Kumar F Reddy
Ex1: Str=Henry D. RICH
here first name=Henry
Middle name=D.
Last Name=RICH
output=Henry D. RICH
Ex2: Str=.Jason Kumar F. Reddy
Here first name=.Jason Kumar
middle name=F.
last name=Reddy
output=.Jason Kumar F Reddy
Hi @SND0912
FullName= "Henry D. RICH" or ".Jason Kumar F. Reddy"
NameParts= System.Text.RegularExpressions.Regex.Replace(FullName.Trim(), "(?<=[A-Z])\.","")
Note: Both FullName and NameParts are of data type System.String
Hope it helps!!
Hi @SND0912
str_Input1 = “Henry D. RICH”
Regex expresion = System.Text.RegularExpressions.Regex.Replace(str_Input1,“[.]”,“”)
You can try this Xaml
Xaml : - remove the Dot in the middle name.zip (1.5 KB)
output : -
Hi Parvathy
Before replace the dot I need to write if condition
Can you please tell me the condition if you don’t mind
If that condition is true we need to replace the dot Parvathy
Hi @SND0912
If
FullName.ToString.Contains(".")
Then
Use the syntax given in the second assign activity i.e NameParts
Print using Log message
Hope it helps
Hi Parvathy
I have done that thing Parvathy
My doubt is u have that regex right how should I use that regex as a condition???
As you said before
If(full name.contains(“.”)
Then
We are replacing the . Right
Else
Nothing
What if that say an example
Input=.Sai M Teja
Output=.Sai M Teja
Is that condition that’s works?
Can to tell exactly to remove dot(.) in middle only or full name or we need to keep in starting
If - condition =“.Sai M Teja”.contains(“.”)
Then
System.Text.RegularExpressions.Regex.Replace(“.Sai M Teja”,“[.]”,“”)
Else
Nothing
Output: Sai M Teja
You can try this way
@SND0912
Yes @SND0912
Can you specify if you need to remove the first dot too.
Regards
No Parvathy
The middle name dot only
In the middle name only only praveen
Hi @SND0912
Assign=> FullName= "Henry D. RICH" or ".Jason Kumar F. Reddy"
If
System.Text.RegularExpressions.Regex.IsMatch(FullName,"[A-Z]\.")
Then
Assign=> NameParts= System.Text.RegularExpressions.Regex.Replace(FullName.Trim(), "(?<=[A-Z])\.","")
Else
Assign=> NameParts= FullName
That particular if condition checks if the middle name contains (.) i.e in your case F. or not. If yes. It will remove. If no, it will print the name present in the variable.
Thanks a lot Parvathy
Thank you so much
My respect to you
If you do find solution for your query please mark it as solution to close the loop.
Happy Automation @SND0912
Regards,
Hi Parvathy ,
as your suggestion above regex
ex: HENRY. J. RICH.
output : HENRY. J RICH.
by using your condition i am getting the output like HENRY J RICH
Hi @SND0912
Assign => FullName= "HENRY. J. RICH."
If
System.Text.RegularExpressions.Regex.IsMatch(FullName,"(?<=\s)[A-Z]{1}\.(?=\s)")
Then
Assign => NameParts= System.Text.RegularExpressions.Regex.Replace(FullName.Trim(), "(?<=\s[A-Z]{1})\.(?=\s)","")
Else
Assign => NameParts= FullName
End If
Hope it helps!!
Thanks Parvathy solved
You’re welcome @SND0912
Happy Automation
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.