Perl regex - Is (x|y)* equivalent to [xy]*?
perl, regex
Solution
Yes, they match the exact same set of strings.
They are not equivalent. `(x|y)*` sets a backreference, `[xy]*` doesn't.
Thus `(?:x|y)*` and `[xy]*` are equivalent in behavior, as neither sets a backreference.
Problem
As the title says, does the regex pattern `(x|y)*` match the same string as `[xy]*`?