Javascript regular expression match string to start with letter or number

javascript, jquery, match, regex

Solution

Use:

^[A-Z0-9]

With a case-insensitive modifier:

if(thestring.match(/^[A-Z0-9]/i)) {}

Demo

`\pL` and `\pN` are PCRE shortcodes and do not work in Javascript.

Problem

I am trying to see if my string starts with a letter or a number. I think I'm close, could anyone help me out? ``` if(thestring.match("/^[\pL\pN]/")) ```

Original source

Related problems