JITU99
(jitendra)
November 16, 2023, 8:33am
1
Hi,
Can someone help with regular expression.
The requirement is the word should contain only these characters(a-z,A-Z ,space,single quote, comma, full stop, forward slash and hyphen
If there are any other special characters/characters then it should replace it with “space”.
Special characters like German Umlaut letters : “ä”, “ö” and “ü” and other characters too.
Yoichi
(Yoichi)
November 16, 2023, 8:37am
2
Hi,
Which do you mean, replace the character with space OR replace word which contains the caharacter with space?
Can you give us some examples?
Regards,
ppr
(Peter)
November 16, 2023, 9:00am
3
For the replacements
strReplaced =
System.Text.RegularExpressions.Regex.Replace(strText, strPattern, “”)
strText - your input Text variable
strPattern - [^A-Za-za ',.\/-]
2 Likes
JITU99
(jitendra)
November 16, 2023, 9:14am
4
Any characters other than these (a-z,A-Z ,space,single quote, comma, full stop, forward slash and hyphen) should be replaced with spaces.
JITU99
(jitendra)
November 20, 2023, 3:48am
5
ppr:
^A-Za-za ',./-
Hi @ppr How can i check if only these characters are present and if anyother characters other than these are present i should return false.
ppr
(Peter)
November 20, 2023, 8:39am
6
with regex.isMatch we can do. Whenever a non valid character is matched it will return true, which we can deny
strText - your input Text variable
strPattern - [^A-Za-za ',.\/-]
Assign Activity
isValid = Not System.Text.RegularExpressions.Regex.IsMatch(strText, strPattern)
[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum
1 Like
system
(system)
Closed
November 23, 2023, 8:40am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.