Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I work with symfony4. I would add same validation to my input number to accept only values like :
1 10 100 1000 10000 100000 1000000
10{0,6}
You have to use Choice validation. All info about choice validation You can find here
Add a comment
You can use regex with this pattern
"/^1+0*/"
Example
class MyClass { /** * @Assert\Regex( * pattern = "/^1+0*/", * message="Wrong number" * ) */ protected $myNumber; }
"/^1[0]*$/"
Demo: https://regex101.com/r/eSnOfp/1
I solved it by this pattern :
pattern="[0-1]+"
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
10{0,6}