Guessing you probably want something closer to `%r(^4\.)`…

```console
>> ["3.4.0", "3.410", "4.0", "4.1"].map {|s| !!%r(4.0).match(s) }
=> [true, true, true, false]

>> ["3.4.0", "3.410", "4.0", "4.1"].map {|s| !!%r(^4\.).match(s) }
=> [false, false, true, true]
```