We are fetching details from a Jira ticket using an API.
One of the fields in the ticket contains usernames entered manually by users in different formats, such as:
Example 1: John,David,Smith
Example 2: John ,David;Smith
Example 3: John;David; Smith
Currently, I am trimming spaces, and for cases where values are comma-separated (Example 1), I am able to split them into an array using comma delimiter.
However, since users are entering values using both commas and semicolons, I need a way to handle all formats and retrieve the usernames correctly as an array.
Instead of depending on the separator, focus on the names, what if tomorrow delimiter got chnaged, for that use regex this will give you the array names as per your input,