Validation Expression

P

pintu

Hi I am writing a validation expression for the followings

1)EPF/chp15_v3.htm#p33
or
2)EPF/chp15_v3.htm

I wrote the validation expression as

[a-zA-Z0-9]*\.(htm|html)\#[a-zA-Z0-9]*$

but for this wont work for the 2nd one though it works for the first
one. Again if i enter "\" there the first one is not working..

So plz help me in solving the problem

Regards
Priyabrata
 
H

Hans Kesting

Hi I am writing a validation expression for the followings
1)EPF/chp15_v3.htm#p33
or
2)EPF/chp15_v3.htm

I wrote the validation expression as

[a-zA-Z0-9]*\.(htm|html)\#[a-zA-Z0-9]*$

but for this wont work for the 2nd one though it works for the first
one. Again if i enter "\" there the first one is not working..

So plz help me in solving the problem

Regards
Priyabrata

With the "\#[a-zA-Z0-9]*" part you are requiring the #, followed by 0
or more letters and/or digits.
Change that to "(\#[a-zA-Z0-9]+)?" to specify optionally a # followed
by one or more letters/digits. So: either no search part OR at least
one character after the #.

Hans Kesting
 
R

Rad [Visual C# MVP]

Hi I am writing a validation expression for the followings

1)EPF/chp15_v3.htm#p33
or
2)EPF/chp15_v3.htm

I wrote the validation expression as

[a-zA-Z0-9]*\.(htm|html)\#[a-zA-Z0-9]*$

but for this wont work for the 2nd one though it works for the first
one. Again if i enter "\" there the first one is not working..

So plz help me in solving the problem

Regards
Priyabrata

Hey Priyabrata

Try this expression. It matches both

..*\.htm(?:\#p\d+)*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top