Solved

regular expression validation

Posted on 2012-04-03
2
234 Views
Last Modified: 2012-04-09
I'm using the followin regular expression validator.  

ValidationExpression="^([a-zA-Z].*|[0-9].*)\.(((p|P)(d|D)(f|F))|((d|D)(o|O)(c|C))|((p|P)(d|D)(f|F))|((d|D)(o|O)(c|C)(x|X))|((t|T)(i|I)(f|F))|((t|T)(i|I)(f|F)(f|F))|((w|W)(p|P)(s|S))|((w|W)(p|P)(d|D))|((r|R)(t|T)(f|F)))$"

I don't understand the "=^([a-zA-Z].*|[0-9].*)\."
Can someone please help me translate this?

Thank you!
0
Comment
Question by:ocdc
  • 2
2 Comments
 
LVL 35

Assisted Solution

by:Terry Woods
Terry Woods earned 500 total points
ID: 37803752
^([a-zA-Z].*|[0-9].*)\.
means:
^  match the start of the string (or line, in multiline mode)
( start a capturing group
[a-zA-Z] match any one alphabetic character
.* match any number of any characters except newline
| logical OR applying within the capturing group
[0-9] match one digit
.* match any number of any characters except newline
) end the capturing group
\. match a . character

To summarise:

It looks like you're matching filenames. That part of the pattern will match and capture the entire filename (and path, if there) up to the extension as long as it starts with a letter or number, except it won't include the . character in the captured group.
0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 37803777
Examples:

For the string:
C:\foo\rhubarb\myfile.pdf
The part of the pattern you're asking about would capture:
C:\foo\rhubarb\myfile
but would match
C:\foo\rhubarb\myfile.

For the string:
123/456/rhubarb/myfile.pdf
The part of the pattern you're asking about would capture:
123/456/rhubarb/myfile
but would match
123/456/rhubarb/myfile.

For the string:
_somedir/rhubarb/myfile.pdf
The pattern would fail to match, as it doesn't start with a number or letter.
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

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

863 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

18 Experts available now in Live!

Get 1:1 Help Now