I have this regex:
const str = '1.22.333';
const patt = /^(?:\d+\.?)+(?<!\.)$/;
const result = str.match(patt);
It only works in Chrome. In Firefox I get:
SyntaxError: invalid regexp group
https://jsbin.com/colehogema/edit?html,js,output
Is there any other way of writing this regex so other browsers can run it?
Requirements:
- Start with number
- End with number
- Numbers separated with one dot
- Only a single number with no dots is valid