Tell us what’s happening:
How the below expression matches this string
thisIsSpinalTap. Since here I does not have a space or _ before so how does it match ?
Your code so far
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36.
Challenge: Spinal Tap Case
Link to the challenge:
this part here match before a capital letter
see the purple line (it is where it matches):
please stop putting solutions without spoiler tags - it is the second one today
I am so sorry. I thought i can put a single line of code without that tag
x(?=y) – positive lookahead (matches 'x' when it's followed by 'y')Since x is not present how it is valid ?
x(?=y) matches the
x if it is followed by
(?=y) matches the point before the
you can play with an online tester if it can help clear your ideas in how things work: https://regex101.com/
const consonantCluster = str.match(/^[^aeiou]+/)
What is this weird syntax at the end you can see , when i remove zero output remains the same
(?=y) matches the point before the y I tried to find it on MDN but this reference was not available. Where did u get it from ?
it is what happens, try on the regex tester online, try to do
"xyxxyyyxux".split(/(?=y)/), it will split before the
Matches at a
position where the pattern inside the lookahead can be matched. Matches only the position. It does not consume any characters or expand the match. In a pattern like one(?=two)three, both two and three have to match at the position where the match of one ends.
match returns an array, with the
 it is selecting the first element in the array from