How to remove special characters from string in Swift

let regex = NSRegularExpression(pattern: ".*[^A-Za-z0-9].*", options: nil, error: nil)!
if regex.firstMatchInString(searchTerm!, options: nil, range: NSMakeRange(0, searchTerm!.length)) != nil {
println("could not handle special characters")

}

My Solution

hello, (Nice to- meet 한국 école %&$you all. 123 ! Давай العربية 😀hello Nice to meet 한국 école $you all 123  Давай العربية 😀

--

--

--

Majored in Physics, self-taught and worked in the IT industry as a Dev/Design/Planning for 11 years. And I had run my Startup for 3 years. I fancy a ☔️ 🇬🇧

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Aggressive enemies, pulling powerups, and negative pickup items

Alexa, ask Journey Further to define programmatic…

Why Hire A Bootcamp Developer?

Valgrind memcheck with R: A quick and dirty guide

How to fix the storage link issue of laravel project on production with using the shared hosting…

eWallet Mobile App Development Essentials | Xicom

COM Server Types: In-Process vs. Local vs. Remote

Use An API To Create Forex Rates Tables

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fredric Cliver

Fredric Cliver

Majored in Physics, self-taught and worked in the IT industry as a Dev/Design/Planning for 11 years. And I had run my Startup for 3 years. I fancy a ☔️ 🇬🇧

More from Medium

Functions(Swift)

Start emulator and simulator from macOS terminal

Yet Another Notes

iOS Real Device Appium Setup