Hi All, Can any one tell me how to find Alphabets only from string.
like - mystring123sting#$r\
Output- mystringstingr
Thanks in advance
Amogh
Hi Amogh,
You can create a function using Regex_Replace from Text.
So first, you reference the action:
Then you call the Regex_Replace like on the image below with the Pattern [0-9]|[$&+,:;=?@#|'<>.^*()%!-]|\\
Basically it will replace numbers or special characters by nothing, in other words it will eliminate them. The output of the function is what you need:
Hope it helps.Cheers,
João
You can simply use JavaScript
function alphaOnly(a) { var b = ''; for (var i = 0; i < a.length; i++) { if (a[i] >= 'A' && a[i] <= 'z') b += a[i]; } document.getElementById("demo").Value=b; //$('#InputID').val(b); }
you can use this function on script or use in JavaScript widget.
Hope this will help you.
Regards
Rahul
Hello Amogh,
You can use a simple JavaScript node to implement your own Regular Expression. Something like this should do the trick:
The Pattern used was [^A-Za-z], which basically detects everything that is not between A - Z and a - z. If so, replace it by an empty string.
Expected result:
Please refer to attached OML.
Hope that this helps you!
Kind regards,
Rui Barradas
Several solutions, consider this when executing if you need this server side then the solution form João is the best one. The one from Rui works best for Reactive and Mobile on the client side.
Hi,
Daniël's point and the number of Regex questions always coming up in Forums here and there made me think we were lacking a component about Regex to provide:
Based on that, I created a Regex How-To component which hopefully will help on the aforementioned scenarios.
Cheers,