Last active
September 16, 2016 16:29
-
-
Save SelStrom/8de6837ab62fdb49e3bd18d14f8f6370 to your computer and use it in GitHub Desktop.
Regular expressions for converting a .fnt file in to .xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fist line: <reg exp> | |
second lines : < | |
code | |
for | |
replasing | |
> | |
(?<!\.)(-?\d+(?:,?-?\d+)*)(?! Semi)(?!\.) | |
"$1" | |
([\s\S]+) | |
<?xml version="1.0"?> | |
<font> | |
$1 | |
</font> | |
((?:info face.+)|(?:common .+)) | |
<$1/> | |
(page id=.+) | |
<pages> | |
<$1/> | |
</pages> | |
((?:char id=.+)|(?:kerning fi.+)) | |
<$1/> | |
(chars count=.+)([\s\S](?:\s+.?char id.+)+) | |
<$1>$2 | |
</chars> | |
(kernings count=.+)([\s\S](?:\s+.?kerning fi.+)+) | |
<$1>$2 | |
</kernings> | |
--------------------- or short form ---------------------------- | |
(?<!\.)(-?\d+(?:,?-?\d+)*)(?! Semi)(?!\.) | |
"$1" | |
((?:char id=.+)|(?:kerning fi.+)) | |
<$1/> | |
(info face.+)[\s\S](common .+)[\s\S](page id=.+)[\s\S](chars count=.+)([\s\S](?:\s*.?char id.+)+)[\s\S](kernings count=.+)([\s\S](?:\s*.?kerning fi.+)+) | |
<?xml version="1.0"?> | |
<font> | |
<$1/> | |
<$2/> | |
<pages> | |
<$3/> | |
</pages> | |
<$4>$5 | |
</chars> | |
<$6>$7 | |
</kernings> | |
</font> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment