Jump to content

[Solved] Regular expression Unicode to ASCII


Trong
 Share

Recommended Posts

 

mikell

;Global $sCharAllowed = ";!#$%&'()+-,.0123456789=@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{ }~"

Local $uStringIN = "頹-衙-浳-浤-搰-橱-煪๏๐๑๒๖D๚๛ẀẁẂẴẵẶặẸẹẺẻỈỉỊAịỌÆ¢™®¯ÌÍÎÏÐÑ×ØÙòóôŘřŢţŷOŸǾǿ₪₫€℅l№™Ωe⅛∑-•v8∫˜≠==□ּׂאַאָאּבּVגּדּהּוּזטּיּךּכשּתּוֹבֿכֿפֿAﭏﭽﮊﮋﮏﮐﮑﮒﮓﮔﺅﺆﺇTﺈﺉﺊﺋﺛﺜﺝﺮﺯﺰﺱﻐRﻑﻒﻓﻔﻕﻟﻠﻡﻢﻣﻤOﻥﻦﻧﻨﻰﻱﻲﻳﻴﻵﻶNﻷﻸﻹﻺﻻﻼْ%-㍱G-煱-둻-睤-㌹-"

Local $lStringOUT = StringRegExpReplace($uStringIN, '[[:^print:]]', "_")

ConsoleWrite($lStringOUT&@CRLF)

jguinch

Global $sCharAllowed = "\w;!#$%&'\(\)+,-.=@\[\]^`{ }~"

Local $uStringIN = "頹-衙-浳-浤-搰-橱-煪๏๐๑๒๖D๚๛ẀẁẂẴẵẶặẸẹẺẻỈỉỊAịỌÆ¢™®¯ÌÍÎÏÐÑ×ØÙòóôŘřŢţŷOŸǾǿ₪₫€℅l№™Ωe⅛∑-•v8∫˜≠==□ּׂאַאָאּבּVגּדּהּוּזטּיּךּכשּתּוֹבֿכֿפֿAﭏﭽﮊﮋﮏﮐﮑﮒﮓﮔﺅﺆﺇTﺈﺉﺊﺋﺛﺜﺝﺮﺯﺰﺱﻐRﻑﻒﻓﻔﻕﻟﻠﻡﻢﻣﻤOﻥﻦﻧﻨﻰﻱﻲﻳﻴﻵﻶNﻷﻸﻹﻺﻻﻼْ%-㍱G-煱-둻-睤-㌹-"
$replace = StringRegExpReplace($uStringIN, "[^" & $sCharAllowed& "]", "_")
MsgBox(0, "", @CRLF & $replace & @CRLF)

 

Edited by Trong

Regards,
 

Link to comment
Share on other sites

or this ?

Global $sCharAllowed = "\w;!#$%&'\(\)+,-.=@\[\]^`{}~"

Local $uStringIN = "頹-衙-浳-浤-搰-橱-煪๏๐๑๒๖๚๛ẀẁẂẴẵẶặẸẹẺẻỈỉỊịỌÆ¢™®¯ÌÍÎÏÐÑ×ØÙòóôŘřŢţŷŸǾǿ₪₫€℅l№™Ωe⅛∑-/•v8∫˜≠==□ּׂאַאָאּבּגּדּהּוּזטּיּךּכשּתּוֹבֿכֿפֿﭏﭽﮊﮋﮏﮐﮑﮒﮓﮔﺅﺆﺇﺈﺉﺊﺋﺛﺜﺝﺮﺯﺰﺱﻐﻑﻒﻓﻔﻕﻟﻠﻡﻢﻣﻤﻥﻦﻧﻨﻰﻱﻲﻳﻴﻵﻶﻷﻸﻹﻺﻻﻼْ%-㍱-煱-둻-睤-㌹-"

$replace = StringRegExpReplace($uStringIN, "[^" & $sCharAllowed& "]", "_")

MsgBox(0, "", @CRLF & $replace & @CRLF)

 

Edited by jguinch
Link to comment
Share on other sites

or this ?

Global $sCharAllowed = "\w;!#$%&'\(\)+,-.=@\[\]^`{}~"

Local $uStringIN = "頹-衙-浳-浤-搰-橱-煪๏๐๑๒๖๚๛ẀẁẂẴẵẶặẸẹẺẻỈỉỊịỌÆ¢™®¯ÌÍÎÏÐÑ×ØÙòóôŘřŢţŷŸǾǿ₪₫€℅l№™Ωe⅛∑-/•v8∫˜≠==□ּׂאַאָאּבּגּדּהּוּזטּיּךּכשּתּוֹבֿכֿפֿﭏﭽﮊﮋﮏﮐﮑﮒﮓﮔﺅﺆﺇﺈﺉﺊﺋﺛﺜﺝﺮﺯﺰﺱﻐﻑﻒﻓﻔﻕﻟﻠﻡﻢﻣﻤﻥﻦﻧﻨﻰﻱﻲﻳﻴﻵﻶﻷﻸﻹﻺﻻﻼْ%-㍱-煱-둻-睤-㌹-"

$replace = StringRegExpReplace($uStringIN, "[" & $sCharAllowed& "]", "_")

MsgBox(0, "", @CRLF & $replace & @CRLF)

 

Ouput=頹-衙-浳-浤-搰-橱-煪๏๐๑๒๖๚๛ẀẁẂẴẵẶặẸẹẺẻỈỉỊịỌÆ¢™®¯ÌÍÎÏÐÑ×ØÙòóôŘřŢţŷŸǾǿ₪₫€℅l№™Ωe⅛∑-/•v8∫˜≠==□ּׂאַאָאּבּגּדּהּוּזטּיּךּכשּתּוֹבֿכֿפֿﭏﭽﮊﮋﮏﮐﮑﮒﮓﮔﺅﺆﺇﺈﺉﺊﺋﺛﺜﺝﺮﺯﺰﺱﻐﻑﻒﻓﻔﻕﻟﻠﻡﻢﻣﻤﻥﻦﻧﻨﻰﻱﻲﻳﻴﻵﻶﻷﻸﻹﻺﻻﻼْ%-㍱-煱-둻-睤-㌹-


@jguinch something wrong!

 

Regards,
 

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

×
×
  • Create New...