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


In reply to Re: Integer regex, different results in windows and mac - I just need regex help by kcott
in thread Integer regex, different results in windows and mac - I just need regex help by hiyesthanks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.