That regex is invalid syntax.
You have this piece:
*{2,}
Which basically would read: match n-times, 2 or more times
.
The following regex:
/\\*.{2,}/
Is the simplest and closest regex to the one you have, which would read as:
match 0 or more '\' and 2 or more characters that aren't newlines
If you are talking about the string itself, is may be interpreted as 2 things:
/\\*{2,}/
Read as: match a single \ and another \ n-times 2 times or more
This is invalid syntax
/\*{2,}\
Read as match 2 or more *
This is valid syntax
It all varies, depending on the escape character.
Edit:
Since the question was updated to show which language and engine it is being used, I've updated to add the following information:
You have to pass the regex as '/\*{2,}/'
OR as "/\\*{2,}/"
(watch the quotes).
Both are very similar, except that single quotes (''
) only support the following escape sequences:
\'
- Produces '
\\
- Produces \
Double-quoted strings are treated differently in PHP. And they support almost any escape sequence, like:
\"
- Produces "
\'
- Produces '
\\
- Produces \
\x<2-digit hex number>
- Same as chr(0x<2-digit hex number>)
\0
- Produces a null
char
\1
- Produces a control char (same as chr(1)
)
\u<4-digit hex number>
- Produces an UTF-8 character
\r
- Produces a newline on old OSX
\n
- Produces a newline on Linux/newer OSX/Windows (when writting a file without b
)
\t
- Produces a tab
\<number>
or \0<number>
- Same as \x
, but the numbers are in octal (e.g.: "\75"
and "\075"
produce =
)
- ... (some more that I probably forgot) ...
\<anything>
- Produces <anything>
Read more about this on https://php.net/manual/en/language.types.string.php