regex - Java Pattern.compile expression - "/login?(\\?.+)?" -
i trying understand regular expression given below:
"/login?(\\?.+)?" i have gone through java docs, not able understand purpose of expression.
i understand looks string starts /login, after characters ?(\\?.+)? represent? please me in understanding this.
/loginmatches literal characters/login- the
?makesnoptional - the
(parentheses)capture match inside group 1 /login\\?matches literal?. in normal regex\?, in java string backslash has escaped backslash- the
.+matches 1 or more characters, can includespaces , dog!
sample matches
/logi /login /login?a /logi?an /logi?and dog general answers "what regex mean?
- you can use tool such see regex101 play regex. right pane explains token token.
- there several explaining tools based on same original perl library, such this one, on 1 of answers based.
- the ultimate answer can found in mastering regular expressions, 3rd ed. , several excellent online tutorials, including regex faq on site.
Comments
Post a Comment