I just want to note something because it got me confused for a sec. On this video @4.00 the split function has been called "s.split(/[,\s/]+/);" with an extra forward slash inside the group in square brackets. This will just add to delimiters the forward slash, is not escaping the right square bracket. Even if it was back slash it wouldn't (most likely it would be syntax error). Just in case this will be useful to anyone.
Your videos are great, but you should look into using the forEach() loop - that would save you so much time and typing, and would make your code more readable. For example, instead of: for (var i = 0; i < words.length; i++) { createP(words[i]; } You can just write: words.forEach(function(word) { createP(word) } )
Yeah, but I preferred not to confuse other readers with arrow functions, since they are less readable, and take more explanation to understand. One thing at a time.
I am currently trying to make something similar with a chatting app, where the # symbol with the word following with be the tags for the post I just don't know the correct regex in order to split and get the different # as tags
"1.JavaScript String function. 2.which is used to split a given piec. 3.defined by a regular expression." output:["1.JavaScript String function.","2.which is used to split a given piec.","3.defined by a regular expression."] please send the regx code
Hi how do i use same regular expression and split on word 'and' along with other symbols like comma,& etc. right now i have split(/[ ,&]+/) and i want to add "and" word as separator along with other symbols
String line = first, second,"hello,world","one,""two""" line.split(",(?=([^\"]|\"[^\"]*\")*$)"); the output is first second hello, world one,two can you please explain how this regular expression working?
First, it looks for a comma. Then, it looks ahead and makes sure that it's followed by - anything but a quotation mark or - quotation mark, anything but a quotation mark (0 or more times) and another quotation mark 0 or more times, and always followed by the end of a line.
I need to fetch half of the value of the full string!(without if else) Now think 1000 times and then reply here i know you will be failed in this case.
The idea of using s.split(/[.\s]+/) to fix unnecessary blank is simply amazing! Best programming teacher across the whole youtube.
Thanks so much for this. I spent the whole day yesterday trying to do what you showed me here!
I just want to note something because it got me confused for a sec. On this video @4.00 the split function has been called "s.split(/[,\s/]+/);" with an extra forward slash inside the group in square brackets. This will just add to delimiters the forward slash, is not escaping the right square bracket. Even if it was back slash it wouldn't (most likely it would be syntax error). Just in case this will be useful to anyone.
yes I got confused about that and had to check. s.split(/[,\s]+/) will also be the same thing
Thank you ! You are a saviour
Love the series on RegEx, good stuff.
la mejor explicacion que he visto sobre expresiones regulares :D
Your videos are great, but you should look into using the forEach() loop - that would save you so much time and typing, and would make your code more readable.
For example, instead of:
for (var i = 0; i < words.length; i++) { createP(words[i]; }
You can just write:
words.forEach(function(word) { createP(word) } )
Heh, I get this comment a lot! Ok, I will use it in a video soon!
If you're only doing one thing a better syntax for a forEach would be:
words.forEach(word => createP(word));
Yeah, but I preferred not to confuse other readers with arrow functions, since they are less readable, and take more explanation to understand. One thing at a time.
How can i extract the last word in a cell? I dont get it. I would be glad for any help. Greetings from germany
I am currently trying to make something similar with a chatting app, where the # symbol with the word following with be the tags for the post I just don't know the correct regex in order to split and get the different # as tags
what if the string starts with a special character then can we split it and get only the tokens.Tokens are sequence of alphabets.
What a wonderful guy!
how much of it is the same with java instead of javascrips??
Nice video, thanks
how to extract before and after two words from particular string using regular expression and c#???
"1.JavaScript String function. 2.which is used to split a given piec. 3.defined by a regular expression."
output:["1.JavaScript String function.","2.which is used to split a given piec.","3.defined by a regular expression."]
please send the regx code
Thanks.
you are the best
This might be a dumb question, but where does the forward-slash come from at the beginning and at the end of the Regex?
Print the characters in a string separated by comma. i need the word run to get as r,u,n can anyone help me plz??
"run".split("").join()
Just awesome!
Thank you!
By seeing the thumbnail of this video I thought that Sundar Pichai is teaching regex
He kinda looks like him
Hi how do i use same regular expression and split on word 'and' along with other symbols like comma,& etc. right now i have split(/[ ,&]+/) and i want to add "and" word as separator along with other symbols
String line = first, second,"hello,world","one,""two"""
line.split(",(?=([^\"]|\"[^\"]*\")*$)");
the output is first second hello, world one,two
can you please explain how this regular expression working?
First, it looks for a comma.
Then, it looks ahead and makes sure that it's followed by
- anything but a quotation mark
or
- quotation mark, anything but a quotation mark (0 or more times) and another quotation mark
0 or more times, and always followed by the end of a line.
How to do this const a=“[{name:”bob”},{name:”ron”}]”;
Expected out put: [{name:”bob”},{name:”ron”}]
Thank you
JSON.parse(a)
hi. Can someone help me ?
I don’t know how to replace word with hyphen. e.x: from “a-b” to “b-a”.
I need to fetch half of the value of the full string!(without if else) Now think 1000 times and then reply here i know you will be failed in this case.
Can you pls give me regex which runs on regex tester ?!