Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 09:42 AM
Hi Kali,
The alphanumeric regex accepts if the string is having only alphabets/only numbers/both alphabets and numbers.
I hope there is no regex that returns true for alphanumeric and false for only alphabets and only numbers.
I have tried the below script in the background which returns the alphanumeric string:
var sub = 'This is a sample case for 123AZBzxc';
var subArr = sub.split(' ');
for (var i in subArr) {
if (new RegExp("^[a-zA-Z0-9]*$").test(subArr[i]) && !(new RegExp("^[A-Za-z]*$").test(subArr[i])) && !(new RegExp("^[0-9]*$").test(subArr[i]))) { //satisfies if the string only alphanumeric
gs.info(subArr[i]);
}
}
If you find this helpful, hit the helpful icon.
Mark the response correct and helpful if the answer assisted your question.