in this ➡"replace(/[^a-zA-Z0-9]+/g,''); "why.... '/g ' used? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

in this ➡"replace(/[^a-zA-Z0-9]+/g,''); "why.... '/g ' used?

explain me plz...

13th Jul 2018, 9:58 AM
R (V👸Rani).💃😘
R (V👸Rani).💃😘 - avatar
5 Answers
+ 1
V-રાની 🙈🙉🙊 that is a g modifier that indicates to search the whole string rather than stopping at the first match to replace. Here's a reference https://www.w3schools.com/jsref/jsref_regexp_g.asp
13th Jul 2018, 10:13 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 6
Thanks all...😊 your information is quite helpful ...
14th Jul 2018, 10:12 AM
R (V👸Rani).💃😘
R (V👸Rani).💃😘 - avatar
+ 5
global search flag
13th Jul 2018, 10:12 AM
D_Stark
D_Stark - avatar
13th Jul 2018, 10:07 AM
MO ELomari
MO ELomari - avatar
+ 2
Erase ('') all the characters (g modifier) which are not (^) belong character (+) a to z A to Z 0 to 9
13th Jul 2018, 10:41 AM
Calviղ
Calviղ - avatar