Here is the Question: You have a test string S.
Your task is to write a regular expression that matches only and exactly strings of form: abc.def.ghi.jkx , where each variable: a,b,c,d,e,f,g,h,i,j,k,x can be any single character except the newline.
Here is the Regular Expression I wrote:
/((w+)?(d+d+)?).((w+)?(d+d+)?).((w+)?(d+d+)?).((w+)?(d+d+)?)(.d+d+)?(.d+d+)?/g
I wrote this Regex as I discovered the different cases for the Hackerrank question. The interesting part is that I cases when tested using Regexer Website Tool, The cases are matching but they are not Matching on the Hackerrank website. Here is the Picture of both Working on Regexer and Not Working on Hackerrank:
I was trying to match the Regex Expression with the given Input. I wrote the Regex Expression for Every Case that was not working. Even If my all Regex is not Correct for all cases it should show for the ones that are Correct, but it is showing for some other comman cases. I tested all using Regexr Tool for thier given Input and its Matching there, but this Hackerrank is Not considering it.