Hello there.
I suggest you first try using split with the comma as delimiter (so don’t remove it) and save first / lastname as separate variables. you can set the comma as a delimiter by making it a variable (“set” or use the ascii command 44). You can then create a new variable that uses these found variables ($firstname$ $lastname$ in any order you set them in your new variable. Use a dollarsign ($) to select variables that were previously created - look for a grey thunderbolt in the advanced command screen.
Blue thunderbolt means: you can create a new variable (no need for dollar) or select one that was previously created).
Should you want to play with regular expressions:
Online help:
https://regex101.com/
Nintex RPA lets you test you regex inside the advanced command (e.g. find) and you can run it on a variable
Good luck.