VIP

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

2 posts in this topic

#1 ·  Posted (edited)

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,
 

Share this post


Link to post
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)

 

1 person likes this

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