I have a string like this:
var s = \"*string1* *string2* *string3*\";
I\'m trying to create a regex which returns an array of the three strings
You need to use lazy quantifier ? here and also escape \
lazy
?
\
Like this \*(.*?)\* Regex101 Demo
\*(.*?)\*
Without using lazy quantifier you can do something like this.
\*[^*]+\* This will match a * everything until a * *. Regex101 Demo
\*[^*]+\*
*
everything until a *
Use \\ instead of \ in actual code.
\\