So I have the expression rule that will abbreviate a string. Thoughts on how to improve?
/*Replace all special characters with spaces*/ /*Replace extra spaces with since space*/ /*Wrap numbers in spaces*/ /*Split words and number sets into array*/ /*ForEach item in array grab number or first letter of word*/ /*Join what is left, upper case string and grab left 50 characters*/ with( local!nospecialcharacters: regexreplaceall( "[^\w\s]", ri!in, " " ), local!extraspaceswithsinglespace: regexreplaceall( "\s+", local!nospecialcharacters, " " ), local!numberwrapper: if(regexmatch("\d+",local!extraspaceswithsinglespace), regexinsertmatchmarkers( "\d+", local!extraspaceswithsinglespace, " ", " ", false ), local!extraspaceswithsinglespace ), local!segments: split( regexreplaceall( "\s+", local!numberwrapper, "|" ), "|" ), local!keepers: a!forEach( local!segments, if( isnull( fv!item ), null, if( not( isnull( tointeger( fv!item ) ) ), fv!item, if( fv!item = " ", null, if( regexmatch("^[a-zA-Z]+$", fv!item ), left( fv!item, 1 ), null ) ) ) ) ), left( upper( joinarray( local!keepers, "" ) ), 50 ) )
Discussion posts and replies are publicly visible