Skip to content Skip to sidebar Skip to footer

Javascript: RegExp Not Working No Matter What My Expression Is

Ok, I've been using RegExp a number of times but for some reason I cannot get it to work this time. I am trying to test for latitude (0 to +/- 90 degrees). No matter what expressio

Solution 1:

Your \ characters are being parsed by the Javascript string literal.

You need to use a regex literal:

var regexLatitude = /^-?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$)/;

Post a Comment for "Javascript: RegExp Not Working No Matter What My Expression Is"