I think Regina figured out who Emma was when Sidney “wrote” that expose during the election in Desperate Souls. Even August admitted to Emma that he fudged some details to keep her identity a secret but apparently, he didn’t do such a good job b/c Regina still put the pieces together.