Jump to content

[Solved] StringRegExp or StringRegExpReplace for get only letters and number!


Recommended Posts

How to return only letters and number (A-Z, a-z,0-9)?

EG: "A Bs3;4fốd'g"  => ABs34fdg

Local $InputString = "A Bs3;4fd'g" ; => ABs34fdg
Local $sOutPut = StringRegExp($InputString, "[:alnum:]")
Local $rOutPut = StringRegExpReplace($InputString, "[:alnum:]", "")

ConsoleWrite("StringRegExp: " & IsArray($sOutPut) & " - " & $sOutPut & @CRLF)
ConsoleWrite("StringRegExpReplace: " & IsArray($rOutPut) & " - "&$rOutPut & @CRLF)

Thanks

Edited by You

Regards,
 

Link to comment
Share on other sites

#include <Array.au3>

Local $InputString = "A Bs3;4fd'g" ; => ABs34fdg
Local $sOutPut = StringRegExp($InputString, "[[:alnum:]]",3)
Local $rOutPut = StringRegExpReplace($InputString, "[^[:alnum:]]", "")

ConsoleWrite("StringRegExp: " & IsArray($sOutPut) & " - " & _ArrayToString($sOutPut,"") & @CRLF)
ConsoleWrite("StringRegExpReplace: " & IsArray($rOutPut) & " - "&$rOutPut & @CRLF)

 

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...