Multiple RegEx Per Key
See original GitHub issueIt was mentioned in #5 that regEx
should support multiple regular expressions for a single schema key. This seems like a good idea. Might be best to name them rather than using an array, and then those names can be used for custom messages:
MySchema = new SimpleSchema({
password: {
type: String,
regEx: {
numbers: twoNumbersRegEx
}
}
});
MySchema.messages({
'regEx.numbers': "[label] must have two numbers"
});
Issue Analytics
- State:
- Created 10 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Multiple regex substitutions using a dict with ... - Stack Overflow
The closest solution I have found for this is to compile a regular expression from a dictionary of substitution targets and then to...
Read more >RegExp - JavaScript - MDN Web Docs - Mozilla
Chrome Edge
RegExp Full support. Chrome1. Toggle history Full support. Edge12. Toggle history
@@match Full support. Chrome50. Toggle history Full support. Edge13. Toggle history
@@matchAll Full...
Read more >Matching Multiple Regex Patterns in Pandas | by Tim Oltman
Pandas provides several functions where regex patterns can be applied ... the method will return a DataFrame with one column for each group....
Read more >Replacing Multiple Patterns in a Single Pass - O'Reilly
The keys are the set of strings (or regular-expression patterns) you want to replace, and the corresponding values are the strings with which...
Read more >Best Practices for Regular Expressions in .NET - Microsoft Learn
In general, regular expressions can accept two types of input: ... means that the regular expression pattern must be recompiled each time ...
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 FreeTop 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
Top GitHub Comments
I have tried implementing exactly as shown here, but it doesn’t seem to work. It just displays the default regEx error message “[label] failed regular expression validation”. Are there any known bugs with feature?
Went with an array because of @sbking’s comment about validation order. Object key order isn’t 100% reliable as spec’d. You can still customize messages based on array index: