Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Regex Question

by AnomalousMonk (Archbishop)
on Nov 07, 2016 at 21:40 UTC ( [id://1175472]=note: print w/replies, xml ) Need Help??


in reply to Regex Question

... I can't guarantee the availability of any non-core modules on whatever system this ends up running on.

It's also useful to know if some minimal Perl version can be expected or not. Ferinstance, version 5.10 adds a bunch of really neat regex extensions, e.g., the recursive  (?PARNO) pattern family.

It's also good to know if the format of the data is as strict as is suggested by your OPed example data; tybalt89's solution depends on the opening keyword and terminal delimiter of each
    object "identifier" in { ... };
group both desperately hugging the left margin, and any departure from this will sink you.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Regex Question
by jedikaiti (Hermit) on Nov 07, 2016 at 22:07 UTC

    Good points.

    For version, 5.10 appears to be the likely minimum - likely enough that anyone stuck with something earlier can be safely told they're on their own.

    The data is, in fact, that strict. If it's not, there are likely bigger problems at work.

    Many thanks!


    What part of v_e = sqrt(2GM/r) don't you understand? It's only rocket science!

      Also be aware that the list of core modules can vary between versions. I've never personally encountered a problem with this; however, if it is an issue for you, you can specify a range of valid versions with use and no.

      Version too old:

      $ perl -v | head -2 | tail -1 This is perl 5, version 18, subversion 0 (v5.18.0) built for darwin-th +read-multi-2level $ perl -e 'use 5.020; no 5.024' Perl v5.20.0 required--this is only v5.18.0, stopped at -e line 1. BEGIN failed--compilation aborted at -e line 1. $

      Version too new:

      $ perl -v | head -2 | tail -1 This is perl 5, version 24, subversion 0 (v5.24.0) built for darwin-th +read-multi-2level $ perl -e 'use 5.020; no 5.024' Perls since v5.24.0 too modern--this is v5.24.0, stopped at -e line 1. BEGIN failed--compilation aborted at -e line 1. $

      Version just right (Goldilocks zone):

      $ perl -v | head -2 | tail -1 This is perl 5, version 22, subversion 0 (v5.22.0) built for darwin-th +read-multi-2level $ perl -e 'use 5.020; no 5.024' $

      — Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-20 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found