# Reg exp

**URL:** <https://www.ruby-forum.com/t/reg-exp/187258>\
**Category:** Rails\
**Created:** [April 20, 2010, 6:35pm UTC](https://www.ruby-forum.com/t/reg-exp/187258 "2010-04-20T18:35:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 20, 2010, 6:35pm UTC](https://www.ruby-forum.com/t/reg-exp/187258/1 "2010-04-20T18:35:01Z")

</div>

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

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

```

?

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 20, 2010, 10:33pm UTC](https://www.ruby-forum.com/t/reg-exp/187258/2 "2010-04-20T22:33:13Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 21, 2010, 12:07am UTC](https://www.ruby-forum.com/t/reg-exp/187258/3 "2010-04-21T00:07:58Z")

</div>

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](http://www.marnen.org)  
removed\_email\_address@domain.invalid
