(WIP) Support regex in matchers
See original GitHub issueDescribe your idea
Support regular expression in Detox matchers
Specifically in by.text()
, by.label()
.
This can be useful since text and labels may include dynamic content (e.g. date).
Also, I suggest to change the current API, from: https://github.com/wix/Detox/blob/246317d3ee5b7587bb966c78204b5def5b72dfaf/detox/index.d.ts#L804
To:
text(text: string | RegExp): NativeMatcher;
Usage example
This code will find an element with the text "The year is 2023"
, if exists:
const someElement = element(by.text(/The year is: \d{4}/));
While this code won’t:
const someElement = element(by.text('The year is: \d{4}'));
Issue Analytics
- State:
- Created a year ago
- Reactions:10
- Comments:8 (1 by maintainers)
Top Results From Across the Web
[WIP] lib: regexp matching in 'subject' and 'from' - notmuch
Date is already searchable, and message_id is not obviously useful to regex match. This was originally written by Austin Clements, ...
Read more >Everything You Need to Know About Regex (WIP) - sab codes
Regex is ran using a regex engine. A regex engine has support for finding, replacing, validating, and splitting. Many programs you are already ......
Read more >TRE regular expression library - IBM
Use the TRE regular expression library to run search queries on both single-byte and multi-byte character languages. The TRE regular expression library supports...
Read more >mvr wip - regex101
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Read more >iWAF Exceptions with Regex Matching for Arguments
This article discusses configuring iWAF exceptions with regex matching for arguments. Avi Vantage supports Regex for URL matching. Avi iWAF uses PCRE (Perl ......
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
@asafkorem the only pitfall I see is that we might need to standardize RegExp mechanisms between iOS/Android/JS…
Nevertheless I’d like this kind of an API to come with a warning of some sort, that would explain that ideally, whichever text we trying to match should be deterministic to the point it can be predetermined down to the character. Of course, this is not always the case in unmocked tests, but generally this should be the preferred situation.