in reply to Re^3: YAML::XS perl/regexp (?u:(?u:
in thread YAML::XS perl/regexp (?u:(?u:

Another possibility would be to continue just using a string. Check with regexp_pattern(), if there are any flags (ignoring u), just store the stringified regex, otherwise store the pattern itself. This would still lead to unnecessary (?:...) but it wouldn't grow in roundtrips.
Have been looking into universal.c how regexp_pattern() is implemented. At the moment it's too much magic for me to understand.