Regular Expression for Multiple options.
I have requiremen like below
I need to write a regular expression for below match
String should start with some charachters and end with digits
ayush1 or gupta1
I was trying like this
But id did not helped.
Basically my requirement to write a regular expression with multiple string options to be matched followed by some sequence of charachters.
So in above case ayush1 should be matched and gupta1 should be matched. and we can give as many string like ayush , gupta for matching with OR option and it should followed by some sequence of charachters only which we will provide in regex.
You can use
makes it easier to get it right.
I tried but not reaching to my requirements :(
One good site to test regular expression is regex101.com
Based on your explanation it seems that
^\w+\d+?$is what you are looking for.
Note that Qt provides the QRegularExpression tool example that allows to test your regular expressions as well as get the string equivalent you need ot use in your code.
For example, my suggestion becomes
VRonin last edited by
You need a non-capturing group:
@vronin Great Thanks