Regex strip out all non alpha Characters from a String
I have created a code where there are many non alpha characters in string and now i want to replace all those non-alpha characters with a # sign.
For example if in my code there is a string There are many numbers like 1234-78.*.25.*.65 , Over here i want to replace * with # sign.Can anyone tell me what should be the code which i need to write.
Re: regex strip out all non alpha
Try to use the following code for replacing non alpha Characters from a String
Code:
Function Demo(ByVal input As String) As String
Dim ab As String = "[1234-78.*.25.*.65]"
Dim xy As String = "#"
Demo = Regex.Replace(input, ab,xy)
End Function
Re: Replace non alpha Characters from a String
If you want replace non alpha Characters from a string by using PHP then use the following code.
PHP Code:
<?php
$string = preg_replace('/[^a-z0-9*]/i', '', $string);
$string = str_replace('*', '%', $string);
?>