The challenge is a little confusing. Really, the best regex to solve it would be /a{2,}/i, or perhaps /aa+/i (match 2 or more “a”s, case insensitive), but that fails the first condition (must use the * character).
It might help to think of the challenge this way:
It must match at least 2 “a”s.
After that, it can match 0 or more “a”s (this makes no difference to how the regex functions, but is necessary to pass the first test case).
I believe that usage of curly braces in regex is not covered yet before this challenge (if you go through the challenges by order of appearance in the curriculum).
If that is the case, I think the challenge description should be updated to make it more clear., or at least change the challenge’s content to match what it teaches…
To be clear, the /a{2,}/i solution isn’t how to pass the challenge, although a valid solution can include curly-brace notation. That’s just what I’d consider to be the best/clearest solution if you needed a regex to do this in production code (maybe for some sort of wookie-themed natural language processing app? )
The code and copy for the fCC challenges is all open source and written by volunteers, and contributions are welcome. I agree it’s somewhat confusing, so I’m opening an issue on the GitHub repo now.
Yes I understood that, all I’m saying is that the challenge, it’s description or it’s solution test need to be rewritten.
I tried to clone the FCC repo and the curriculum repo to fix a different bug, but ran into problems.
There is a known bug happening with running FCC locally, and I understood from other people in the Contributors’ Gitters chat room that it’s being addressed.
I also tried to commit a change and ran into problems with that…
Try http://regexr.com/ and paste your pattern, and apply the flags, and put sample text there to see. The lower part says that it shouldn’t detect anything.
i am not perfect in JavaScript but here if you do /a*/i , it only search for matching AAAAAAA or aaaaa not match Aaaaa or aAAAAA so you have to add one A in Aaaaaa or a in aAAAAA . i think you got it