?
Solved

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

Posted on 2014-03-02
6
Medium Priority
?
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 35

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Accepted Solution

by:
Dan Craciun earned 2000 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 35

Expert Comment

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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

764 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