Solved

regex on input with certain special characters, certain number only, certain characters

Posted on 2014-03-02
6
280 Views
Last Modified: 2014-03-12
is there any regex where i could retrieve and validate

ASDF / 1031 / 0122223333

where
first is characters
second is 4 digit numeric only
and then numerics (no limitation)

'/' have to be existed.
0
Comment
Question by:doramail05
  • 3
  • 2
6 Comments
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39899651
Try this:
[A-Za-z]* / \d{4} / \d{1,}

Open in new window


HTH,
Dan
0
 
LVL 14

Expert Comment

by:sentner
ID: 39899656
Are there spaces surrounding the '/' characters (there are in the example).

Simple regex to match that pattern:

^[A-Z]{4} / \d{4} / \d+$

If no spaces should be there, then this:
^[A-Z]{4}/\d{4}/\d+$

If the last section can be blank (zero or more digits) then you can replace the '+' with '*'
0
 
LVL 1

Author Comment

by:doramail05
ID: 39899816
having :
CS1009: Unrecognized escape sequence

with the error underline the \d
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 34

Accepted Solution

by:
Dan Craciun earned 500 total points
ID: 39899835
RegexBuddy says this should work in C#:

@"[A-Za-z]* / \d{4} / \d{1,}"

Open in new window

0
 
LVL 1

Author Comment

by:doramail05
ID: 39899862
dan craciun,

                  ok
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 39922735
Glad I could help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now