Fix RegexSerializer

Fixes #19. Added support to the flags field during writing an reading.