Can anybody break down this Regular Expressions line for me please,?
/^[a-z][a-z]+\d*$|^[a-z]\d\d+$/ig
It’s from Regular Expressions - Restrict Possible Usernames.
For some reason I’m not quite getting this.
Thanks,
Stvee
Can anybody break down this Regular Expressions line for me please,?
/^[a-z][a-z]+\d*$|^[a-z]\d\d+$/ig
It’s from Regular Expressions - Restrict Possible Usernames.
For some reason I’m not quite getting this.
Thanks,
Stvee
I’ll give this a shot - but I also suggest plugging it into regexr for a full breakdown.
Really the first regex (^[a-z][a-z]+\d*$) matches all strings that start with at least two letters and end with any number of digits (including no digits), then the second regex (^[a-z]\d\d+$) matches all strings that start with exactly one letter and end with at least two digits.
Hope that helps and sorry if I missed anything!
(edited to fix a typo & formatting)
Thank you for your reply, Lucas.
To be honest I think I had just about figured it out, I think you know a lot more than me though.
Thanks.
Steve
Hi again Lucas,
I have just looked through your answer again, don’t totally get it yet but that is the best help I could ever ask for. Cheers.
Steve
Happy to help! If there is something specific you still have a question about let me know.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.