Solved

regular expression

Posted on 2009-04-05
4
312 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
[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
  • 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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

617 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