Reg exp

What would the reg expression be for a string of 13 consecutive digits
in javascript?

 var textfieldIdRegexp = /^\d{13}/;

?

ES wrote:

What would the reg expression be for a string of 13 consecutive digits
in javascript?

 var textfieldIdRegexp = /^\d{13}/;

Do you mean a string matching exactly 13 digits?

/^\d{13}$/

Or, a string containing a 13 digit sequence?

/\d{13}/

Or, string starting with 13 consecutive digits?

/^\d{13}/ (What you showed in your post.)

ES wrote:

What would the reg expression be for a string of 13 consecutive digits
in javascript?

 var textfieldIdRegexp = /^\d{13}/;

?

This has nothing to do with Rails, and should be asked on a JavaScript
forum.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs