Mark regexp as non-capture

Benchmark created on


Setup

const withCapture = /^\s*(?<values>((lat|lt)\s*:?\s*-?(90(\.0+)?|[1-8]?\d(\.\d+)?)\s*[;,]?\s*(lng|lon|ln)\s*:?\s*-?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)|(lng|lon|ln)\s*:?\s*-?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\s*[;,]?\s*(lat|lt)\s*:?\s*-?(90(\.0+)?|[1-8]?\d(\.\d+)?))(\s*[;,]?\s*((lat|lt)\s*:?\s*-?(90(\.0+)?|[1-8]?\d(\.\d+)?)\s*[;,]?\s*(lng|lon|ln)\s*:?\s*-?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)|(lng|lon|ln)\s*:?\s*-?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\s*[;,]?\s*(lat|lt)\s*:?\s*-?(90(\.0+)?|[1-8]?\d(\.\d+)?)))*)\s*$/;

const  noCapture = /^\s*(?<values>(?:(?:lat|lt)\s*:?\s*-?(90(?:\.0+)?|[1-8]?\d(?:\.\d+)?)\s*[;,]?\s*(?:lng|lon|ln)\s*:?\s*-?(180(?:\.0+)?|1[0-7]\d(?:\.\d+)?|\d{1,2}(?:\.\d+)?)|(?:lng|lon|ln)\s*:?\s*-?(180(?:\.0+)?|1[0-7]\d(?:\.\d+)?|\d{1,2}(?:\.\d+)?)\s*[;,]?\s*(?:lat|lt)\s*:?\s*-?(90(?:\.0+)?|[1-8]?\d(?:\.\d+)?))(?:\s*[;,]?\s*(?:(?:lat|lt)\s*:?\s*-?(90(?:\.0+)?|[1-8]?\d(?:\.\d+)?)\s*[;,]?\s*(?:lng|lon|ln)\s*:?\s*-?(180(?:\.0+)?|1[0-7]\d(?:\.\d+)?|\d{1,2}(?:\.\d+)?)|(?:lng|lon|ln)\s*:?\s*-?(180(?:\.0+)?|1[0-7]\d(?:\.\d+)?|\d{1,2}(?:\.\d+)?)\s*[;,]?\s*(?:lat|lt)\s*:?\s*-?(90(?:\.0+)?|[1-8]?\d(?:\.\d+)?)))*)\s*$/;

const a = 'lat 3 lon 10, lat 90.0 lon 20';
const b = 'ln9lt3ln23.55lt12'
const c = 'lng: 173.3 lat: 28.54, lng: 12.5 lat 76.274'

Test runner

Ready to run.

Testing in
TestOps/sec
With capture
withCapture.exec(a)
withCapture.exec(b)
withCapture.exec(c)
ready
No capture
noCapture.exec(a)
noCapture.exec(b)
noCapture.exec(c)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.