Last active
August 29, 2015 14:03
-
-
Save jack126guy/c63ca4f15c494aab7ff8 to your computer and use it in GitHub Desktop.
Forigi iksojn el X-sistema Esperanto (Remove X's from X-system Esperanto)
This file contains hidden or 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
#!/usr/bin/perl | |
#Tiu-ĉi programo estas en la publikaĵo (This program is in the public domain) http://creativecommons.org/publicdomain/zero/1.0/ | |
#Legi tekston el norma enigo (Read text from standard input) | |
while(<STDIN>) { | |
#Anstataŭigi X-sistemajn vicojn (se ne estas alia X poste) [Replace X-system sequences (if there is not another X afterwards)] | |
s/c[xX]([^xX])/ĉ$1/g; | |
s/g[xX]([^xX])/ĝ$1/g; | |
s/h[xX]([^xX])/ĥ$1/g; | |
s/j[xX]([^xX])/ĵ$1/g; | |
s/s[xX]([^xX])/ŝ$1/g; | |
s/u[xX]([^xX])/ŭ$1/g; | |
s/C[xX]([^xX])/Ĉ$1/g; | |
s/G[xX]([^xX])/Ĝ$1/g; | |
s/H[xX]([^xX])/Ĥ$1/g; | |
s/J[xX]([^xX])/Ĵ$1/g; | |
s/S[xX]([^xX])/Ŝ$1/g; | |
s/U[xX]([^xX])/Ŭ$1/g; | |
#Anstataŭigi duoblajn iksojn post apartaj literoj (Replace double X's after certain letters) | |
s/(c|g|h|j|s|u)(x)x/$1$2/ig; | |
#Eligi (Output) | |
print; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment