I tried to create a regex to match a letter only once and even though I knew I had to use a negative lookahead, I couldn't come up with it. Here it is, amazing regex!
I wonder how the length of an empty array could be 26?
Like, why not return (string.match(/([a-z])(?!.*\1)/ig)).length === 26;?
//And why doesn't the editor consider my RegExp to end...?
(I'm not very good at RegExp's, forgive me)
JS
I pass all the intitial tests.
I've filtered out 'words' with spaces but I only pass about 2/3's (on average) of the main tests.
I've looked at a couple of the failed tests and if there are any differences between my result and the provided solution, they are not visible to the naked eye - so invisible characters perhaps...
Anyone have any clues?
Hi, I split the string into an array using space as a separator. Then I used the filter() method to get rid of all the empty strings in my array. I carried out all the other operations with the array returned by filter() method. I can't disclose my code here because it will be a spoiler
Unconventional approach. Cool
Nice one!
I tried to create a regex to match a letter only once and even though I knew I had to use a negative lookahead, I couldn't come up with it. Here it is, amazing regex!
Thanks Ambrelium, finally understood.
nice explaination
i made this with out regex, hahahah !!!! with O(n) loop
string.match() will return null if there's no match, and null has no property named 'length". So by doing || [], you ensure that length will work
Interesting RegExp !!!
This should be the top solution its more effecient. Really long repetitive strings would bog the top one down.
I wonder how the length of an empty array could be 26?
Like, why not return (string.match(/([a-z])(?!.*\1)/ig)).length === 26;?
//And why doesn't the editor consider my RegExp to end...?
(I'm not very good at RegExp's, forgive me)
JS
I pass all the intitial tests.
I've filtered out 'words' with spaces but I only pass about 2/3's (on average) of the main tests.
I've looked at a couple of the failed tests and if there are any differences between my result and the provided solution, they are not visible to the naked eye - so invisible characters perhaps...
Anyone have any clues?
Hi, I split the string into an array using space as a separator. Then I used the filter() method to get rid of all the empty strings in my array. I carried out all the other operations with the array returned by filter() method. I can't disclose my code here because it will be a spoiler
Thank you, I have been trying to sort this but couldn't get it to work correctly
resolved
resolved
Loading more items...