By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,349 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

Escape .(dot) in a Regular Expression

P: n/a
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
Nov 17 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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)
Nov 17 '08 #2

P: n/a
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
Nov 17 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.