The first commented regular expression almost fits my need, except I need it to find "ng" followed by either a,e,i,o,u as a match itself. Been trying for hours to no avail.
Example:
tanga should return "ta" and "nga"
nganga = nga nga
amboy = am boy
tomboy = tom boy
Any help will be greatly appreciated.Code:var bla; bla = "nganga"; var result; //var syllableRegex = /[^aeiou]*[aeiou](?:[^aeiou]*$|[^aeiou](?=[^aeiou]))?/gi; var syllableRegex = /[^aeiou]*[aeiou](?:[ng](?=aeiou)*$|[^aeiou]*$|[^aeiou](?=[^aeiou]))?/gi while (result = syllableRegex.exec(bla)) { var Match = result[0]; alert(Match); alert(syllableRegex.lastIndex); }




Reply With Quote