javascript - string.match() with wildcard of unknown length -
i need use string.match()
find values in javascript string. part of value match contains unknown characters. if know there 2 unknown characters, can following.
string.match(/foo..bar/);
my question is, if don't know length of unknown (whether need .
or ..
or ...
), there regex way this? solution know of call string.match()
multiple times, curious if there's better one.
if charater, use "." , if can occur 0 or more times (any no of times) use "*" greedy operator in regex. so, can use:-
string.match(/foo.*bar/);
Comments
Post a Comment