Can someone help me with a regex to match on any string that has exactly 2 periods?
This should match: 12.3.2 Fusion
This should not match: 12.3.2.1 Fusion.
I know this is failrly easy i’m sure. Just not too familiar with regex yet.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That would be:
Explanation:
^and$are “start of string” and “end of string”; here, they ensure that you’re matching the entire string.[^abc]means “any character that is notaorborc“; so,[^.]*is a substring that does not contain any periods.\.means “a period”. (Without the backslash,.means “any character except newline”, which is not what you want.)