TOOKT
(Tord Rune Kvikstad)
August 25, 2023, 12:31pm
1
Hey,
Have a problem with removing the last 6 characters of a string.
I have a get text activety that gets name and number however I wanna remove the number:
Name:
Tommy Lundgren 123654
John Stockton 123666
Ella Abba 144456
I’ve tried the guid for How to manipulate a part of string: Split, Trim, Substring, Replace, Remove, Left, Right - #36 by Adrian_Star
Can someone please give me some advice?
@TOOKT
Assign
Var=System.text.regularexpression.regex.match(input,“[A-Za-z\s]+”).value
Try this
Cheers
mkankatala
(Mahesh Kankatala)
August 25, 2023, 12:35pm
3
Hi @TOOKT
Use the below regular expression
- Assign -> StrVar = "Tommy Lundgren 123654
John Stockton 123666
Ella Abba 144456"
- Assing -> Output = System.Text.RegularExpressions.Regex.Replace(StrVar.ToString,"(\d{6})","").trim
Check the below workflow for better understanding
Hope it helps!!
2 Likes
Use this regex pattern
take assign activity and
give some variable and in value to save
System.Text.RegularExpressions.Regex.Match(input String variable,“.*(?=\d{6})”).Value
Hope this helps
1 Like
lrtetala
(Lakshman Reddy)
August 25, 2023, 12:42pm
5
Hi @TOOKT
NamewithNumber.Substring(0, NamewithNumber.Length - 6)
TOOKT
(Tord Rune Kvikstad)
August 25, 2023, 12:43pm
6
Belive it or not but ChatGPT solved it with, I’m sure all your suggestions will work tho.
System.Text.RegularExpressions.Regex.Replace(“strName”, “.{6}$”, “”)
1 Like
system
(system)
Closed
August 28, 2023, 12:44pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.