Help Modifying RegEx To Return Range of Digits

Currently this expression "I ([a-zA-z]\d]{3} " returns when the following pattern is true:

I AAA 
I Z99 

I need to modify this so it will return a range of alphanumerics after the I from 2 to 13 that do not have a space.

Example:

I AAA 
I A321 
I ASHG310310 

Thanks,

Dave

Answers


Without the quotes:

"I ([a-zA-Z\d]{2,13}) "

The {} brackets allow two parameters seperated by a comma, which indicates the minimum and maximum number of repetitions. Also, I'm not sure if your original regex gets what you intend - as it's written, it accepts 3 groups of a letter and a number.

You may want to try

I ([a-zA-Z]|\d){2,13}

There's a reference page here: http://www.regular-expressions.info/reference.html


Need Your Help

REST web services: Symfony 2 vs silex

php rest symfony silex

We're going to implement a set of REST web services in PHP. We've selected 2 frameworks to do that: Symfony 2 and Silex (micro-framework as a phar archive, based on Symfony2).

SensorKinect not installing?

windows-8 github kinect sensor openni

I was recently following a tutorial in a "Kinect Hacking" book that I purchased on Amazon. The first thing I was asked to do, is to check to see if my Kinect plug would fit into my laptop's which i...