Feature Request: Allow `regexmatch` on objects other than strings
See original GitHub issueIt would be very helpful to be able to run a regexmatch
check on an array, for example.
I found an easier way around the problem I wanted to solve, but the general functionality would still be powerful.
regexmatch("^\d{3}$", [1, 22, 333, 4444])
would match 333
. But this opens the question of when the whole test is true. Do all elements of the array have to match (&&
) or just one (||
). Perhaps this could be an argument to regexmatch(pattern, object, strictness)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
re — Regular expression operations — Python 3.11.1 ...
Source code: Lib/re/ This module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched ......
Read more >Regular Expression (Regex) Tutorial
Regular Expression, or regex or regexp in short, is extremely and amazingly powerful in searching and manipulating text strings, particularly in processing ...
Read more >String.prototype.match() - JavaScript - MDN Web Docs
The match() method retrieves the result of matching a string against a regular expression.
Read more >Best Practices for Regular Expressions in .NET - Microsoft Learn
Match (String, String). This method doesn't require instantiation of a regular expression object. You can instantiate a Regex object and call ...
Read more >Regular Expressions :: Eloquent JavaScript
Other than that, the object looks like (and in fact is) an array of strings, whose first element is the string that was...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s right, it would return
boolean[]
; and yes.Yeah, I realized after your
file.tags
use-case that some better array support was needed. I have a slightly different idea for the implementation - I can make common methods likeregexmatch
“vectorized”, which means they return an array of results if the input is an array. Then, I can add theany()
andall()
methods, which check if any/every element in an array is true or false. You could then check if any string matches viaany(regexmatch(regex, [...])
and all strings via
all(regexmatch(regex, [...])