Sign in to follow this  
Followers 0
gseller

Remove Characters and whitespace in a string?

4 posts in this topic

I have been looking in the forum and hlpfile and cannot find anything like StringUpper and StringLower that will remove everything but a digit from a string? what I need is to be able to paste a telephone number in and as most people put a space or dash or even a dot I want to be able to submit and it remove all but the digits in a string.. Any ideas?

Share this post


Link to post
Share on other sites



MsgBox(0, "Regular Expression Replace Test", StringRegExpReplace("419-333-5555", "[^0-9]", ""))

Share this post


Link to post
Share on other sites

MsgBox(0, "Regular Expression Replace Test", StringRegExpReplace("419-333-5555", "[^0-9]", ""))

^Yup very powerful function! I'm starting to like it too :)

Check this out:

$my_pnumber = "My Phone Number is: (419)333-5555"
MsgBox(0, "Info", $my_pnumber)
MsgBox(0, "Extracted Phone Number", StringRegExpReplace($my_pnumber, "[^0-9]", ""))

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Share this post


Link to post
Share on other sites

OMGosh!! Thank you aslani & weaponx , I am so glad that wasn't a snake, woulda bit me on the bum.. LOL I searched and searched the helpfile and even glanced over this on but never put 2 and 2 together. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0