News for hackers. Stuff that matters.
Re:Regex Crossword by mgraczyk on Sunday November 30, 2014 @07:28PM (#8678889)
No, it doesn't. It matches the empty string at the beginning of 'QQQQ', not the Qs themselves:

    /A*/.exec('QQQQ')
    [""]
When computer scientists discuss what a regular express does and does not "match", they are saying that strings which are "matched" by a regex are those strings which are members of the regular language defined by the regex. QQQQ is not a string in the language defined by /A* /, so /A* / does not match QQQQ.

If we look at things your way, we would have to say that the regex /A/ matches "AQQQQ". It does not. It matches "A".

There are no comments on this comment yet.