Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript - Regex, is there a marker for any string?

str.replace(/\w*(\ || --> A marker whitch can represent any char or string? <-- || )/g, function() {return "(" + arguments[0] + ")"})

like image 371
Freezy Ize Avatar asked Sep 06 '25 03:09

Freezy Ize


1 Answers

The dot (.) matches any (1) character; .+ matches a string of at least length 1, .* matches a string of at least length 0.

like image 138
robertklep Avatar answered Sep 07 '25 21:09

robertklep