Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 29th, 2006, 11:54 PM
Registered User
Join Date: Jun 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to skyler
Default Replace method don't work with [ ] /

I’m having problem with replace method, I can’t replace the char “[”, “]” and “/”. I tried with back slash, ascii, and didn’t worked. Look the example:

var tex = "[link href=”...”] Test [/link]";

tex = tex.replace(/[link href=/gi,'<a href=');
tex = tex.replace(/[/link]/gi,'</a>');


Someone have any idea?

Reply With Quote
  #2 (permalink)  
Old December 30th, 2006, 10:04 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

[ and ] are reserved characters, used to delineate character sets such as [1-9] for digits except zero. You should be able to write:

Joe (Microsoft MVP - XML)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Would this php cookies embedding method work? Puripong PHP How-To 0 November 8th, 2007 10:34 AM
Replace Method in JavaScript kwilliams Javascript How-To 2 April 3rd, 2007 12:50 PM
CompositeDataBoundControl's Render method not work bmains ASP.NET 2.0 Professional 0 January 12th, 2006 09:22 AM
Insert method doesnot work shoakat Classic ASP Databases 3 November 22nd, 2004 07:46 PM
String.replace() method JohnD Javascript 0 August 20th, 2004 06:46 AM

All times are GMT -4. The time now is 05:25 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.