DraqueT / PolyGlot

PolyGlot is a conlang construction toolkit.
MIT License
389 stars 44 forks source link

More regex examples #916

Open skribe opened 4 years ago

skribe commented 4 years ago

An enhancement I'd like to see is examples of regex either in help or listed in the programme itself. For example how to find the nth letter in a word, how to determine if the first/last letter is a vowel/consonant. Maybe even how to swap letters around (not sure that one is possible but its something real world languages do). Unfortunately, regex while extremely powerful is also abstruse. And frankly it breaks my brain. Some more help would be greatly appreciated.

Thanks for the latest update.

DraqueT commented 4 years ago

This is something that I have been meaning to do for some time. There are a couple of helper languages under help, but I should expand them significantly.

skribe commented 4 years ago

You probably already have solutions but if not then I've got a couple thanks to /r/regex: Nth last letter in a word: [a-zA-Z](?=[a-zA-Z]{1}\b) Change the {1} to whatever nth you need. This one will give you the second last letter: ^.+(.).$ Ends in a vowel ^.+([aeiou])$ Begins with a vowel: ^([aeiou]).+$

HTH

skribe