The ‘^’ and ‘$’ characters are crucial in JavaScript Regular Expressions. They can be used to specify how a tested string must begin or end.
The ‘^’ character matches the beginning of a string. The code /^j/ will return true for any string that begins with ‘j’ and false for any string that begins with a [...]
Filed under: JavaScript, Programming, Web | 3 Comments »