Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Integer regex, different results in windows and mac - I just need regex help

by kcott (Chancellor)
on Oct 19, 2017 at 03:28 UTC ( #1201648=note: print w/replies, xml ) Need Help??


in reply to Integer regex, different results in windows and mac - I just need regex help

G'day hiyesthanks,

Welcome to the Monastery.

Please post your results with your question. Guidelines for posting questions can be found in "How do I post a question effectively?". You can update your post with the results; "How do I change/delete my post?" explains how to do this.

A screenshot of your terminal is an inappropriate way to present your results; however, when you do have a link to post, please create an actual link (not a URL as plain text) — "What shortcuts can I use for linking to other information?" has details about this.

From the code you posted, I'd say the first thing you should do is read "perlretut - Perl regular expressions tutorial".

Here's the regexes you could have used to match the numbers in your DATA section:

$ perl -E '/^0$/ and say for qw{19 -22 498 512 15 -932 0 22 808 17 -32 +}' 0 $ perl -E '/^[1-9]\d*$/ and say for qw{19 -22 498 512 15 -932 0 22 808 + 17 -32}' 19 498 512 15 22 808 17 $ perl -E '/^-[1-9]\d*$/ and say for qw{19 -22 498 512 15 -932 0 22 80 +8 17 -32}' -22 -932 -32

That was run on "macOS 10.12.5" using "Perl 5.26.0". I don't have MSWin available to run a comparison; although, I'd be highly surprised if the results differed.

If you believe you're getting different results on various platforms, you should provide details of the OS and Perl you used (as I did above).

— Ken

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2018-09-20 02:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (170 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!