• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need a regular expression

 
srivijay varma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need a regular expression which will alert me when it finds these characters in string we provide "'/#\.

For example : A sample code #"vijay" (at # and " it should give me alert).
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried? What errors are you seeing?
 
dharmendra Rathor
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be this will help you
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>

<TITLE> New Document </TITLE>
<script type="text/JavaScript">
function checkString() {
var checkRE = '[\#\"\\\/\']' ;
var inputString = document.forms[0].phone.value
if(inputString.match(checkRE)) {
alert( "String contain special char " );
}
}
</script>
</HEAD>
<BODY>
<form>
Enter string
<input type="text" name="phone" onKey Up="checkString()">
</form>
</BODY>
</HTML>
[ May 03, 2007: Message edited by: pragmatic dsr ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"dsr_esoteric",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

thanks,
Dave
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"pragmatic dsr",

Please re-read the following quote from David's post:

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.


Pay particular attention to the phrase "Fictitious names are not allowed".

Adherance to these rules is not optional, and this is your final warning. Adjust your display name to comply with the required standards prior to your next post.

Failure to comply will result in the removal of your account.

bear
JavaRanch Sheriff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic