Hi, I'm trying to do a regular expression, which I am pretty new to.
What I am trying to do is remove all characters from a string that is not a number or a space;
so for example the text: adsf69a4 65asfd
should be outputed as: 694 65
I have tried different combinations of this regular expression but can't get it to work properly.
This is what i have so tried and various combinations:
[PHP]$number = eregi_replace("[^0-9\s]", "", $number);[/PHP]
[PHP]$number = eregi_replace("[^0-9][:space:]", "", $number);[/PHP]
[PHP]$number = eregi_replace(" ([^0-9]|[^\s])", "", $number);[/PHP]
any help on this would be great. Thanks.
What I am trying to do is remove all characters from a string that is not a number or a space;
so for example the text: adsf69a4 65asfd
should be outputed as: 694 65
I have tried different combinations of this regular expression but can't get it to work properly.
This is what i have so tried and various combinations:
[PHP]$number = eregi_replace("[^0-9\s]", "", $number);[/PHP]
[PHP]$number = eregi_replace("[^0-9][:space:]", "", $number);[/PHP]
[PHP]$number = eregi_replace(" ([^0-9]|[^\s])", "", $number);[/PHP]
any help on this would be great. Thanks.
Comment