https://github.com/rampaa/unicoderangetoutf16compliantregex
Non-Basic Multilingual Plane Regex Ranges to UTF-16 Compliant Regex
https://github.com/rampaa/unicoderangetoutf16compliantregex
regex regex-pattern regexp supplementary-plane surrogate-pairs unicode utf-16
Last synced: about 1 year ago
JSON representation
Non-Basic Multilingual Plane Regex Ranges to UTF-16 Compliant Regex
- Host: GitHub
- URL: https://github.com/rampaa/unicoderangetoutf16compliantregex
- Owner: rampaa
- License: other
- Created: 2023-12-24T17:46:13.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-24T20:20:57.000Z (over 2 years ago)
- Last Synced: 2025-01-27T23:43:18.902Z (over 1 year ago)
- Topics: regex, regex-pattern, regexp, supplementary-plane, surrogate-pairs, unicode, utf-16
- Language: C#
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Some programming languages that use UTF-16 for strings face problems with unicode ranges not found in [Basic Multilingual Plane](https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane) (e.g., [CJK Unified Ideographs Extension B](https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_Extension_B)) while matching those characters with using RegEx (see: https://github.com/dotnet/runtime/issues/79865). This program converts unsupported unicode range RegExes into UTF-16 compliant RegExes. For example, `[\U00020000-\U0002A6DF]` will be converted into `\uD840[\uDC00-\uDFFF]|[\uD841-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF]`.
The code is basically taken from https://stackoverflow.com/a/47627127 with some small modifications. This repo solely exists for the sake of convenience.