I need some help in evaluating a regular expression in some code.I am trying to evaluate the regular expression
/^\s*(\*|[\w\-]+)(?:\b|$)?/i
I think I figured the following:
^ – Beginning of character
\s* – zero or more occurrences of white space
(\*|[\w\-]+) – I understand the \w standards for word but I am not sure what \* and the or | is evaluating to and the + specifies one more more occurrence of the preceding pattern.
(?:\b|$)? – I need help in understanding this and the expression as a whole.
i – Ignore case
Can some help me understand what (?:\b|$)? is evaluating for and the expression as whole? Any help would be appreciated.
1 Answer