Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex match all Vular Fractions

There are 18 vulgar fraction symbols and I would like to match them in regex.

Is this the best way listing them all

/[¼½¾⅐⅑⅒⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞]/
like image 663
Daniel Avatar asked Jan 03 '23 15:01

Daniel


1 Answers

They are Unicode characters.

¼½¾ have the continuous Unicode values (from \u00BC to \u00BE), and the rest (⅐⅑⅒⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞) have the continuous Unicode values (from \u2150 to \u215E).

You can use this [\u00BC-\u00BE\u2150-\u215E].

like image 149
Eric Na Avatar answered Jan 19 '23 13:01

Eric Na