-1

This is from an online quiz I am taking. Makes no sense to me though, because abbb:

  1. Starts with mandatory a - check!
  2. Has one or more b's after a - check!
  3. Has 0 occurance of c - check!

Thoughts? Am I missing something here?

whoshotya
  • 49
  • 4

2 Answers2

0

There are multiple online regex tools you can use to test that out.

https://regex101.com/ is an ad-free site with multiple regex implementations (php, javascript, python, and golang). Here's a link with your test case: https://regex101.com/r/9uI9Uw/1.

Your reasoning is correct and abbb is a match for the regex /ab+c?/.

Javascript snippet:

const s = 'abbb'
console.log(s.match(/ab+c?/))
metame
  • 2,480
  • 1
  • 17
  • 22
0

According to your description,I think that you want is this.

^ab+[^c]*$
Mr.lin
  • 99
  • 3