[SOLVED] Why this is returning false?
Here's the code link: https://code.sololearn.com/WMDQHz9b3R0z/?ref=app
because /re*ex/ search for 'r' followed by 0 or more 'e', then followed by 'ex'... instead try /re.*ex/ wich search for 're' followed by 0 or more any char, then followed by 'ex' ;)
Kê[email protected] Use the "." And "*" together Like /re.*ex/ it will find any number occurance of any character including 0 occurance after "re"
Kê[email protected] n* Matches any string that contains zero or more occurrences of n Means re*ex Will match reex (0 occurance of e) Will match reeex (1 occurance of e) Another example Ar*av Will match Arav (0 occurance of r) Will match Arrav (1 occurance of r) And so on if there would be any other characters other than the character that is precided by * it will not match
Kê[email protected] yeah
visph Thanks for your response But would you please elaborate in a better way? I didn't got you 😅
Arnav Kumar Yea I tried and it worked fine But needs explaination, why it's not working with only asterisk. The tutorial video I watched on YouTube, it was working fine there.
Kê[email protected] Ohh I thought you only want to use it for 1 character as by seeing your string 😅
You're using wrong think use /re.ex/ not /re*ex/
Assassin Period (.) symbol is used for only one character But if we use asterisk (*) here, it will be able to find match for more than one characters
Arnav Kumar Oh I see!! It means the every character should be the same in place of asterisk? Edit:- reeeeeeeex // true reeeeegex // false
Assassin no no 😅
* apply to the previous character (or group) in the regex pattern: /re*ex/ will match 'rex' (0 occurences of first e), 'reex' (1 occurence), 'reeex' (2 occurences)... and so on... . match any character, .* match 0 or more any character: /re.*ex/ will match 'reex' (0 occurences), 'regex' (1 occurence), 'reflex' (2 occurences)... and so on...
I have tried every way I could find but still I can't display my local images ..what am I doing wrong?
Pls rectify the errors.
I cant understand what the problem here is. Can anyone help me out? the system in sololearn called it an error in test case 1
Izzy the iguana code coach