Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^4: YAML::XS perl/regexp (?u:(?u:

by tinita (Parson)
on Dec 19, 2017 at 21:17 UTC ( #1205874=note: print w/replies, xml ) Need Help??

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.

Replies are listed 'Best First'.
Re^5: YAML::XS perl/regexp (?u:(?u:
by ikegami (Pope) on Dec 20, 2017 at 15:57 UTC

    I don't know what you mean by "check with regexp_pattern(), if there are any flags (ignoring u)". Do you mean "check if the results of ( regexp_pattern(qr/$pat/) )[1] contains anything but u"? It never will (unless you use use re "/...", which would be bad here).

      I mean, when Dump()ing a regex, not when Load()ing it.

        oic what you mean. When serializing, if there are no flags, use the current syntax, but exclude the wrapping (?:...).

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1205874]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2021-09-19 13:59 GMT
Find Nodes?
    Voting Booth?

    No recent polls found