A value type I can't understand? - var re = /\s*(;|$)\s*/


#1

Hello,

In Mini Linter Project https://www.codecademy.com/courses/introduction-to-javascript/projects/mini-linter the first step is splitting a string into its words as a new array. So, I didn’t know how to do it and I went to MDN 's site, I found the .split() method which I can apply on the string. After I applied it to my string I 've realized that it had some punctuations like double quotes, dash, period, etc… I wanted to write a code to exclude them from my new array. Found some explanations about this in the following part of the web page related to .split() method on the MDN site, but there is that value I can’t read. I didn’t even know how to call this value type, so I couldn’t search it. Could you please briefly explain what is this or this type of values: var re = /\s*(;|$)\s*/, another example I found on stackoverflow.com is /(?=[\s\S])/u

Thank you,
Ege


#2

its a regular expression, regular expressions are a tricky thing. But once you know what they are, there is plenty of information you can find on the web


#3

Thanks for the reply. And can I also ask that is it gonna be taught at some point within “Introduction to JavaScript” syllabus on Codecademy? Or I should figure it somewhere else on the web?


#4

its not part of the course. Regex is you will need to find somewhere else.