AlmarM Posted September 23, 2010 Posted September 23, 2010 Hiya! How do I replace all non "A-Z, a-z" characters inside a string? I think I should use StringRegExpReplace, but I have no idea how to get the right pattern. For example: User enters: "Europe" Action Taken: None, there are no other characters detected. User enters: " Europe" Action Taken: Replace " " with "" User enters: "12Europe" Action Taken: Replace "12" with "" User enters: "(Europe)" Action Taken: Replace "(", ")" with "" So as you can see, only "A-Z, a-z" characters are allowed. Thanks! Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
Danny35d Posted September 23, 2010 Posted September 23, 2010 (edited) Try it:$UserEnters = ' 1(2E[u]ro)p e' MsgBox(0, "Regular Expression Replace Test", StringRegExpReplace($UserEnters, '[^a-zA-Z]|\W', '')) Edited September 23, 2010 by Danny35d gcue 1 AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
AlmarM Posted September 23, 2010 Author Posted September 23, 2010 Try it:$UserEnters = ' 1(2E[u]ro)p e' MsgBox(0, "Regular Expression Replace Test", StringRegExpReplace($UserEnters, '[^a-zA-Z]|\W', '')) Hey thanks! ^^ Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now