VÜlgÅr. A language generator

What is RegEx?

RegEx (regular expression) is a programming syntax for matching patterns in text. In Vulgar, RegEx can be implemented in the custom orthography option to mimic the spelling idiosyncrasies of natural languages.

Replace an IPA symbol at the beginning of a word only

RegEx uses the carat symbol ^ to signify the beginning of line of text. The pattern ^dʒ will match /dʒ/ at the beginning of a word, but not the middle or end. Thus, the rule ^dʒ > j would change /dʒudʒ/ to judʒ.

Try it yourself:

Result:

Replace an IPA symbol at the end of a word only

The dollar sign $ is used to match characters at the end of a line. The rule dʒ$ > dge changes /dʒudʒ/ to dʒudge. You could then combine this with the first rule to turn /dʒudʒ/ into judge.

Result:

Replace multiple IPA symbols

Square brackets [] are used to match any character inside them. For instance, [ɐɑ] > a means both /ɐ/ and /ɑ/ turn into a. You can put as many characters as you want inside the square brackets, but it will treat everything as an individual character. If you want both /ɔ/ and /əʊ/ to turn into o you can use the use the vertical line symbol | to form an 'or' expression, for example ɔ|əʊ > o.

Result:

Result:

Negative matching

The carat symbol inside the square brackets [^] matches anything except whatever else is inside the brackets:

Result:

Replace an IPA symbol with itself & something else

Say you wanted to put a x after every vowel. This means matching multiple symbols without replacing them, but by adding to them. You can retain the matched pattern by using $&. For example, [aeiou] > $&x will find any vowel and put x on the end.

Result:

To mimic French spelling we can modify this rule to be applied to the end of a word only:

Result:

Lookahead

Lookahead allows you to match a letter and then look ahead of it to meet certain conditions. The conditions will be inside brackets with the ?= symbol at the beginning (?=like this), and only what's outside the brackets will change. In combination with a square brackets pattern, we can make rules to change a /k/ sound into a c letter in conditions that aren't when it comes before /i/ or /e/:

Result:

Negative lookahead is the same principle, but the rule is applied if the there is no match. It uses the ?! symbol:

Result:

Replace with nothing

Creating a rule with nothing on the right side of the > symbol will simply delete everything on the left side of the rule; [aeiou] > will replace all vowels inside the brackets with nothing. Arabic and Hebrew are examples of languages that do not have letters for their vowels.

Result:

Replace everything

All orthography can be deleted using the dot symbol . which signifies any character. The rule . > x translates to take any character and replace it with x.

Result:

Non-Latin alphabets

Custom orthography also supports all Unicode alphabets and scripts, such as Japanese, Chinese, Cyrillic, Georgian and even Unicode Emojis.

Create katakana orthography:

ka > カ
ki > キ
ku > ク
ke > ケ
ko > コ
sa > サ
si > シ
su > ス
se > セ
so > ソ
ta > タ
ti > チ
tu > ツ
te > テ
to > ト
na > ナ
ni > ニ
nu > ヌ
ne > ネ
no > ノ
ha > ハ
hi > ヒ
hu > フ
he > ヘ
ho > ホ
ma > マ
mi > ミ
mu > ム
me > メ
mo > モ
ja > ヤ
ju > ユ
jo > ヨ
ra > ラ
ri > リ
ru > ル
re > レ
ro > ロ
wa > ワ
wi > ヰ
we > ヱ
wo > ヲ
a > ア
i > イ
u > ウ
e > エ
o > オ
n > ン

Order of rules

The order of your custom orthography rules matter. Vulgar will find-and-replace the first orthography rule to a word, then apply the next rule over the top of what it just did. This can be a problem if an IPA symbol appears again in a consonant cluster in a later rule. For instance, the following rules are problematic:

ʃ > sh
tʃ > ch

The intent is for /tʃ/ to change to ch. However in word such a /tʃar/, the first rule will find /ʃ/ and change the orthography to tshar. Then when it moves to the second rule it will fail to find /tʃ/. One solution to this is the flip the rules:

tʃ > ch
ʃ > sh

Created and designed in Sydney, Australia.
Vulgarlang.com © 2017.