Issue splitting string with regex in velocity
Hi!
I have been having issues trying to split a series of strings in one line by different delimiters.
This is the code I am using:
#set ($latestMeetingTimeFromArray = $latestMeetingTimeFrom.split("\s|[:\.]"))
#set ($latestMeetingTimeFromArrayString = $convert.toString($latestMeetingTimeFromArray))
array : $latestMeetingTimeFromArrayString <br>
(I'm printing out the array for debugging)
$latestMeetingTimeFrom can have values like the following:
12:00 PM
1:30 AM
11.00 PM
My aim is to store hours minutes and the meridiem in three separate variables, and as you can see, the delimiters are colon, dot and space.
I have tried all sorts of supposedly valid regex expressions to indicate all possible delimiters (with character set, three individual chars in OR, one char set with all three... ) and I have even tried passing a limiter of 0 and 3, but still the array ends up containing only one character: the hours value.
Example output:

The only way I have managed to get this to work is by replacing all delimiters with the same one (i.e. a space), then simplyfying the regex to just that one character.
Additionally, those three lines of code already break the email when there is a "." separating hours and minutes. Here is the error

Any idea why this is happening?