Jump to content

Replace all NON "A-Z, a-z" characters inside a string


AlmarM
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...