Javascript Regular expression

I need 2 javascript regular expressions one where        GEI/any 3 alphabets/any 9 digits

second where                           first three alphabets should not be GEI/any 3 alphabets/any 9 digits
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Could you create a well formatted question? Thanks.
Rainer JeschorCommented:
perhaps this helps:
var pattern1 = /(GEI)\/[A-z]{3}\/\d{9}/g;
var pattern2 = /(?!GEI)...\/[a-z,A-Z]{3}\/\d{9}/g;

Open in new window

see here:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Terry WoodsIT GuruCommented:
@RainerJ's first pattern may cause problems if you use [A-z], as other characters (non-alpha) may occur between the ASCII codes for A and z. It also needs a start and end-of-string placeholder (^ and $) to ensure other characters aren't included at either end. It should be:

var pattern1 = /^(GEI)\/[a-zA-Z]{3}\/\d{9}$/g;

Open in new window

The second pattern should have the , removed, and ^ and $ added, so:
var pattern2 = /^(?!GEI)...\/[a-zA-Z]{3}\/\d{9}$/g;

Open in new window

ps: Please split the points with @RainerJ if you accept my answer...
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

ok guys, going to buy a new set of glasses...
Terry WoodsIT GuruCommented:
Rereading the question, I wonder if the 2nd pattern should be this:

var pattern2 = /^(?!GEI)[a-zA-Z]{3}\/[a-zA-Z]{3}\/\d{9}$/g;

Open in new window

That means you're wanting 2 groups of 3 alpha characters, separated by /, as long as the first 3 aren't GEI.
RobOwner (Aidellio)Commented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
Terry WoodsIT GuruCommented:
In this case, I believe my answer was correct and deserves some points.

I recommend a split with @RainerJ's answer #39477889 (50%), and mine: #3947818 (25%), and #39478250 (25%).

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.