1. This is documented behaviour for mawk:

    A string expression is converted to numeric using its longest numeric prefix as with atof(3).

    atof is essentially the same as strtod, and strtod recognises inf or infinity. Since both convert the longest numeric prefix, INFO becomes positive infinity.

    However the version of mawk I have (1.3.4.20250131-1 from Debian 13) doesn’t match the third line — the behaviour changed in late 2024:

    modify calls on stdtod() to disallow hexadecimal, infinite and not-a-number values unless the "--posix" option is given

  2. If you want to limit values to strings only containing digits, then as far as I know you’d have to match them as in your example ($1 ~ /^[0-9]+$/) since infinity and NaN are allowed (and even “0x”-prefixed hexadecimal numbers).

Answer from Stephen Kitt on Stack Exchange
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › match
String.prototype.match() - JavaScript | MDN
const str1 = "All numbers except NaN satisfy <= Infinity and >= -Infinity in JavaScript."; const str2 = "My grandfather is 65 years old and My grandmother is 63 years old."; const str3 = "The contract was declared null and void."; str1.match("number"); // "number" is a string.
🌐
W3Schools
w3schools.com › jsref › jsref_match.asp
W3Schools.com
The match() method returns null if no match is found. ** If the search value is a string, it is converted to a regular expression.
Discussions

awk - The string "INFO" matches mawk's inf (infinity) - Unix & Linux Stack Exchange
For quick code I tend to match numbers in awk with an expression such as $1+0. However, today I've found that mawk's inf (infinity) matches not only the text inf but also the word INFO: mawk -F':' ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
1 day ago
What's The True Difference Between string.find(), string.match(), [string].find(), [string].match(), [string]:find(), [string]:match()?
I know this is quite a long question, but to put it short, what is the difference between the find and match methods? I hate stuff like this. When there are similar options, I can’t make my mind up without knowing the true difference. Please help and put my mind at ease, thank you! More on devforum.roblox.com
🌐 devforum.roblox.com
1
12
January 2, 2025
Regex string match?
I have a long string in javascript like var string = 'abc234832748374asdf7943278934haskhjd'; I am trying to match like abc234832748374 - that is - I have tried like string.match(\abc[^abc]|\de... More on stackoverflow.com
🌐 stackoverflow.com
How to match a String against string literals? - Stack Overflow
I'm trying to figure out how to match a String in Rust. I initially tried matching like this, but I figured out Rust cannot implicitly cast from std::string::String to &str. fn main() { ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
fish-shell
fishshell.com › docs › current › cmds › string-match.html
string-match - match substrings — fish-shell 4.5.0 documentation
If you specify the -e or --entire then each matching string is printed including any prefix or suffix not matched by the pattern (equivalent to grep without the -o flag). You can, obviously, achieve the same result by prepending and appending * or .* depending on whether or not you have specified ...
🌐
Python documentation
docs.python.org › 3 › library › re.html
re — Regular expression operations
3 days ago - A regular expression (or RE) specifies a set of strings that matches it; the functions in this module let you check if a particular string matches a given regular expression (or if a given regular expression matches a particular string, which comes down to the same thing).
Find elsewhere
🌐
Medium
medium.com › @qdangdo › regex-a-way-to-match-any-pattern-of-string-1dd327130fc6
Regex: A Way to Match Any Pattern of String | by Quang Do | Medium
October 5, 2021 - The best way to learn is through practice so go to https://regex101.com/ and follow along. Let’s say I have a test string of “abcdefg” and “ABCDEFG”. Type in only a period in the regular expression box and you will see your words light up. It matches!
🌐
RegExr
regexr.com
RegExr: Learn, Build, & Test RegEx
Build a suite of tests that your expression should (or should not) match.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-string-match-method
JavaScript String match() Method - GeeksforGeeks
July 11, 2025 - The match() method in JavaScript is used for identifying and retrieving substrings that fit a specified pattern, defined by a regular expression. It is often used when you need to find particular patterns within strings, enabling efficient text ...
🌐
MathWorks
mathworks.com › matlab › language fundamentals › data types › characters and strings
matches - Determine if pattern matches strings - MATLAB
TF = matches(str,pat,IgnoreCase=true) ignores case when determining if pat matches str. ... Create a string array.
🌐
Medium
medium.com › nerd-for-tech › basics-of-javascript-string-match-method-ce47295bfd97
Basics of Javascript · String · match() (method) | by Jakub Korch | Nerd For Tech | Medium
June 9, 2021 - The match() method searches a string for a match against a regular expression, and returns the matches, as an Array object.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › visual-basic › programming-guide › language-features › operators-and-expressions › how-to-match-a-string-against-a-pattern
How to: Match a String against a Pattern - Visual Basic | Microsoft Learn
September 15, 2021 - Put brackets ([ ]) in the pattern string, and inside the brackets put the list of characters. Do not separate the characters with commas or any other separator. Any single character in the list makes a successful match.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.text.regularexpressions.regex.match
Regex.Match Method (System.Text.RegularExpressions) | Microsoft Learn
Searches the specified input string for the first occurrence of the regular expression specified in the Regex constructor. public: System::Text::RegularExpressions::Match ^ Match(System::String ^ input);
🌐
CodingNomads
codingnomads.com › match-string-javascript
JavaScript String Matching
Learn string matching in JavaScript and how to use regex for complex patterns, from checking substrings to extracting emails.
🌐
LeetCode
leetcode.com › problems › repeated-string-match
Repeated String Match - LeetCode
Can you solve this real interview question? Repeated String Match - Given two strings a and b, return the minimum number of times you should repeat string a so that string b is a substring of it.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › String.html
String (Java Platform SE 8 )
October 20, 2025 - An invocation of this method of the form str.matches(regex) yields exactly the same result as the expression ... Returns true if and only if this string contains the specified sequence of char values.