roy roy

roy roy

  • NA
  • 27
  • 0

Matching substring using regular expression

May 28 2007 5:00 AM
hello.
Your help is very much appreciated.
I am creating user input validation in a web application,
For that, I want to create regular expression to make sure that a certain substring is NOT contained within the string.
i.e.
word to look for -> "DELETE"
 string " xxx DELETE ffff" will FAIL validation(the word DELETE is contained)

 string "xxxDELETEfff" wil succeed (the word DELETE is not contained).

* Another question: Is it possible to contactenate this regular expression into an existing one?

i.e.
I have regular expression for checking name field(maximum of 40 charcters), is it possible to add to it the regular expression that checks for substring ?
i.e.
the regular expression will check that the name contains maximum 40 chracters AND that it does NOT contain "DELETE" substring?
" George Bush" -> will pass validation.
" George DELETE Bush" -> will fail.


thank you for your help.
It is very much appreciated.

Roy



Answers (1)