I want to creating regex to remove some matching string, the string is phone number
Example user input phone number like this:
+jfalkjfkl saj f62 81 78
Using PCRE regexes, you should be able to simply remove anything matching \D+. Example:
\D+
echo "+jfalkjfkl saj f62 81 7876 asdadad30 asasda36" | perl -pe 's/\D+//g'
prints:
628178763036