خرید بک لینک

Vote count: 0

I'm looking for a way in which I can split a string upon matching a certain criteria; I also require the string to split after the argument, as opposed to before it.

For example, let's say I have a string, "Auxiliary", and I want this string to split upon finding the first vowel -- additionally, if the following the word is also a vowel, then it must not split until it has reached the last vowel in the sequence.

So, in this case "Auxiliary" would become ["Au" "xiliary"] As another example, "Doorknob" would become ["Doo" "rknob"] Lastly: "Green" would become ["Gree" "n"]

Currently, if I were to do this: "Auxiliary".split("u"), then the result would be ["A", "uxiliary"] -- I need a way to make the split method split after the match, as opposed to before, so it displays like: ["Au", "xiliary"]

Similarly, I need a way to match the pattern I described above. I'm aware I could do something such as "Auxiliary".split(/[aeiouAEIOU]/), but this would only split the first time it finds a vowel.

I'm aware I seriously need to improve my knowledge of regex - ha.

If my explanation is not clear enough, then please let me know.

All help is super appreciated. +1 for clear explanations and elegant answers!

Thank you.

asked 35 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 29 فروردين 1396 ساعت: 8:34

صفحه بندی