I have these two regex statements, they are working as expected.
.[ािीुूृेैोौं]?
For e.g. नमो first match न
निमो first match नि
.्.[ािीुूृेैोौं]?
For e.g. व्यैक्ती first match व्यै
I am interested only in the first match and it returns it correctly. But I am not able to join these 2 statements into a single one.
Update:
I am looking for a way to join these 2 statements so that I can type any word and I will get the correct results. As of now I need to check the word type and apply the appropriate regex to get the correct results.
Statement 1:
.[ािीुूृेैोौं]?[ं]?
अंबा > अं
लिंग > लिं
लैंगिक > लैं
Statement 2:
.्.[ािीुूृेैोौं]?[ं]?
प्रयत्न > प्र
व्यंकटेश > व्यं
I am trying to return only the fist match and therefore no need to look around :)
The user @jhnc has mentioned the correct command in comment.
(.्.[ािीुूृेैोौं]?[ं]?)|(.[ािीुूृेैोौं]?[ं]?)
Using pipe | for OR is a good idea. But the order of groups is very important. For e.g. this returns incorrect results...
(.[ािीुूृेैोौं]?[ं]?)|(.्.[ािीुूृेैोौं]?[ं]?)