Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
It is silly but I was trying to check alphanumeric pattern and than replace it with a string. I tried to use matches, replaceAll and many more thing. In my findings I understanding that I am not defining the pattern correctly. I hope you guys can help with this silly issue.
Input as string | Expected output |
orange | orange |
1orange | not alphabet |
1--2 | not alphabet |
2~9 | not alphabet |
mango | mango |
12~banana | not alphabet |
my code:
StringHandling.LEN(row1.NAME) ==0 ? "":
row1.NAME.matches("^[0-9|A-Z]{3}.*") ? "not alphabet" :
row1.NAME
Try to use this, check the length, then if it contains numeric then populate with "not alphabet" else the value of string
StringHandling.LEN(row1.NAME) ==0 ? "":
row1.NAME.Contains("[0-9|") ? "not alphabet" :
row1.NAME
It Didn't work for me:
input = 1~6
Relational.ISNULL(row1.NAME) ? "" :
StringHandling.LEN(row1.NAME) ==0 ? "" :
row1.NAME.contains("[0-9]") ? "not alphabet" : row1.NAME
I also tried to use IS_ALPHA but it its giving wrong output incase of space between the string "Black Berry"
Relational.ISNULL(row1.NAME) ? "" :
StringHandling.LEN(row1.NAME) ==0 ? "" :
StringHandling.IS_ALPHA(row1.NAME) ? row1.NAME : "not alphabet"
yes i agree with @uganesh that will take only alphabets in the string