This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes need a regular expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "need a regular expression" Watch "need a regular expression" New topic
Author

need a regular expression

srivijay varma
Greenhorn

Joined: Nov 15, 2006
Posts: 5
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

Joined: Apr 14, 2004
Posts: 10336

What have you tried? What errors are you seeing?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
dharmendra Rathor
Greenhorn

Joined: Mar 20, 2007
Posts: 17
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

Joined: Mar 06, 2001
Posts: 13459

"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

Joined: Jan 10, 2002
Posts: 60749
    
  65

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: need a regular expression
 
Similar Threads
How to escape regular expression's special characters using javascript?
Efficient Text Parsing
Validating html
TextArea processing
regular expression which doesnt alllow *