Quiz time 2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Quiz time 2

Create a program that Count s the number of special characters (all chars excluding alphabets, numbers, space) in the string eg; input: hurray!!, I got a fancy mail_ID 100%@gmail.com output : 7 // i.e; ! - first spl char !- second spl char , - third spl char _- fourth spl char %- fifth spl char @ -sixth spl char . - seventh spl char so the output is 7😉

31st May 2017, 7:38 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
12 Answers
+ 7
https://code.sololearn.com/WkcdB2fY0m0z/?ref=app
31st May 2017, 7:56 AM
Tim G
Tim G - avatar
+ 6
g stands for global search match the entire string rather than just the first occurance https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions
31st May 2017, 8:15 AM
Burey
Burey - avatar
+ 3
@ offline your code is great you made the code in the similar way i thought😂😂🙌🙌
31st May 2017, 8:03 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 2
@ Burey what does that "/g" stands for? (in line 23)
31st May 2017, 8:02 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 2
you can check for existence of any char: https://code.sololearn.com/wV3kfFNbhdFf/#php
31st May 2017, 8:11 AM
Michal
Michal - avatar
+ 2
thnx @ burey i have created another quiz too check it out😉 https://www.sololearn.com/discuss/433841/?ref=app
31st May 2017, 8:35 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 2
hey, click this link for finding the special symbols with optimal code. Enjoy👍 https://code.sololearn.com/c52DrXK5nRim/?ref=app
31st May 2017, 7:35 PM
Hemant Makar
Hemant Makar - avatar
+ 1
Java: text.split("[^a-zA-Z0-9 \t]").length - 1;
31st May 2017, 8:01 AM
Szabó Gábor
Szabó Gábor - avatar
31st May 2017, 8:04 AM
Szabó Gábor
Szabó Gábor - avatar
+ 1
@Hemant Congo man😉
1st Jun 2017, 5:47 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
0
thanks bro
1st Jun 2017, 3:17 PM
Hemant Makar
Hemant Makar - avatar