Skip to content

Instantly share code, notes, and snippets.

@jack126guy
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jack126guy/c63ca4f15c494aab7ff8 to your computer and use it in GitHub Desktop.
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)
#!/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