Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Escape .(dot) in a Regular Expression

Reply
Thread Tools

Escape .(dot) in a Regular Expression

 
 
bharath_r
Guest
Posts: n/a
 
      11-17-2008
Hi,

I would like to know how can i escape a .(dot) in a regular expression
in javascript. I tried using 'backslash' to escape the 'dot' but its
not working. By default a 'dot' takes any character entered. I want to
escape it.

Thanks
Bharath
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      11-17-2008
bharath_r wrote on 17 nov 2008 in comp.lang.javascript:

> I would like to know how can i escape a .(dot) in a regular expression
> in javascript. I tried using 'backslash' to escape the 'dot' but its
> not working. By default a 'dot' takes any character entered. I want to
> escape it.
>


\. is working

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      11-17-2008
bharath_r wrote:
> I would like to know how can i escape a .(dot) in a regular expression
> in javascript. I tried using 'backslash' to escape the 'dot' but its
> not working. By default a 'dot' takes any character entered. I want to
> escape it.


You need either to escape the backslash in the string value that you are
passing or you must pass a RegExp literal instead.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read strings cantaining escape character from a file and useit as escape sequences? slomo Python 5 12-02-2007 11:39 AM
javascript regular expression methods, problem with escape characters lev Javascript 9 09-17-2006 07:49 AM
Matching abitrary expression in a regular expression =?iso-8859-1?B?bW9vcJk=?= Java 8 12-02-2005 12:51 AM
How to escape hex digits in a regular expression!!! aefxx Java 1 12-17-2004 10:12 PM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments