I have been using regex for a long time to determine an assignee name based on the first initial of a students last name. Now, we are alpha-splitting workloads more granularly. Instead of simple single letter to single letter ranges, they are now up to 3 letter ranges. To my knowledge, this is where regex is not well suited because it doesn't directly support alphabetical range comparisons for full strings. Below is an examle of my current snippet, followed by the new alpha-split paramaters. Notice how with the new splits, the first is from 1 to 3 characters and the last group is from 3 to 1 characters. Any ideas on how to accomplish this?
{note: preview=yes; insert=no; color=none}
{formtext: name=enter name} <- type a first and last name to generate a split.
{name=`enter name`; trim=no}
{parts=splitregex(trim(name),"^\w+(\W+)"); trim=no}
Parts = {=parts}
{lastname=parts[count(parts)]; trim=no}
Last name={=lastname}
{initial=split(lastname, "")[1]; trim=left}
Initial={=initial}
{if: testregex(initial, "[a-e]", "i"); trim=left}
{assignee="Agent 1"; trim=left}
{elseif: testregex(initial, "[f-k]", "i"); trim=left}
{assignee="Agent 2"; trim=left}
{elseif: testregex(initial, "[l-q]", "i"); trim=left}
{assignee="Agent 3"; trim=left}
{elseif: testregex(initial, "[r-z]", "i"); trim=left}
{assignee="Agent 4"; trim=left}
{endif: trim=left}{endnote}{=assignee; trim=no}
{note: preview=yes; insert=no; color=none}
New Alpha-split of Last Names: a-eck: Agent 1
New Alpha-split of Last Names: ecl-lee: Agent 2
New Alpha-split of Last Names: lef-rob: Agent 3
New Alpha-split of Last Names: roc-z: Agent 4
{endnote}