Validation Expression

  • Thread starter Thread starter pintu
  • Start date Start date
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
 
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
 
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+)*
 
Back
Top