Replaced `match` with `charAt`