Solved

regular expression

Posted on 2009-04-05
4
296 Views
Last Modified: 2012-05-06
Hello

I need to search for P123/ABC using a regular expression?

Thanks for your help
0
Comment
Question by:Skycapt
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:cubeeq
ID: 24073588
Could you be more specific? You can find this exact expression when you just call it: P123/ABC.
0
 
LVL 1

Author Comment

by:Skycapt
ID: 24075433
Oh sorry,

I have a list of products P123 to P500 in number order but 5 or 6 of them have the extended code P123/ABC the numbers and letters may vary so you may get P234/DEF they also may change from day to day so I cant just isolate individual codes.

Hope that helps
0
 
LVL 3

Accepted Solution

by:
cubeeq earned 250 total points
ID: 24075699
ok, the most general variant is "P[0-9][0-9][0-9](/[A-Z][A-Z][A-Z])?" - it also matches P000/AAA, you can narrow it to "P[1-5][0-9][0-9](/[A-Z][A-Z][A-Z])?" and so on. if you want the most specific thing, i will post something more complex.
0
 
LVL 1

Author Closing Comment

by:Skycapt
ID: 31566842
Hi, thanks for your help, here's my final code

'^[P][0-9]{3}(/[A-Z]{3})?$'
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 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