Solved

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

Posted on 2014-03-02
6
279 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Windows Service with UDP 2 28
comparing string in C# 3 33
Create XML 5 31
Iterate two lists and remove inactive 11 19
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

708 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

13 Experts available now in Live!

Get 1:1 Help Now