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
|
|---|