question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matches does not work

See original GitHub issue

Error CS1929
'IRuleBuilderOptions<MyModel, int>' does not contain a definition for 'Matches' and the best extension method overload 'DefaultValidatorExtensions.Matches<MyModel>(IRuleBuilder<MyModel, string>, string)' requires a receiver of type 'IRuleBuilder<MyModel, string>'

Code:

RuleFor(r => r.ProductType).Matches(@“^[0-9]*$”);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JeremySkinnercommented, Jul 20, 2016

That’ll be why. Matches can only be used with string properties…internally it uses the standard .net Regex. You can’t use this on non-string properties.

0reactions
jbardrofcommented, Jul 20, 2016

That makes sense, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Regex doesn't work in String.matches()
Welcome to Java's misnamed .matches() method... It tries and matches ALL the input. Unfortunately, other languages have followed suit :(.
Read more >
Why isn't the Java matches method working? (Java pattern ...
There are actually two possible solutions to this problem: Modify your regex pattern to match the entire String, and keep using the matches...
Read more >
Matcher.matches() is not working as expected
I am trying to match DateTime input using the Pattern and Matcher class of Apex but wasn't able to achieve it. I've created...
Read more >
Not working in UIPath Matches - Activities
Below is my test inside the Matches activity, but when in the actual run, it cannot find any match while still using the...
Read more >
apex - patern and matcher not working
You have to call myMatcher.find() . Calling matches just tells you if the expression matches the whole input. Also note that you need...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found