473,499 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

More regex problems

These give me "invalid character". Why? Is it the ampersand or the
<>?

source=source.replace( /\</g, "&lt;" );
source=source.replace /\>/g, "&gt;" );

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #1
2 886
Christopher Benson-Manica wrote on 03 dec 2004 in comp.lang.javascript:
These give me "invalid character". Why? Is it the ampersand or the
<>?

source=source.replace( /\</g, "&lt;" );
source=source.replace /\>/g, "&gt;" );


You miss the ( in the second example
You don't need to escape the < and >

Why ask? Did you try to temporarily removing the & ?

Please try first and ask later.
Jul 23 '05 #2
Evertjan. <ex**************@interxnl.net> spoke thus:
You miss the ( in the second example


Today's been a bad day; can't believe I missed something so simple.
Sorry, and thanks.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
412
by: Felix Schwarz | last post by:
Hi all, I'm experiencing problems with a regular expression and I can't figure out which words I use when googling. I read the python documentation for the re module multiple times now but still...
2
2707
by: Ram Sundaram | last post by:
Hi, I am trying to port some linux code to windows under Visual studio. The regex package currently used is the GNU regex package which calls for <strings.h>. This is not found in visual studio....
1
1463
by: philipl | last post by:
hi, does any one how to do regex to get the charset in this strings? "SCRIPT language="JavaScript" charset="ISO-8859-1">..."...."..."...">?" ^^^^^^^^^^ I want the value after charset,...
3
1771
by: Phil396 | last post by:
I am trying to mix metacharacters and the literal versions in an expression and no matter what I try it does not work. Here is the code customer = Regex.Replace(customer,"$",""); I want to...
3
904
by: Vishal | last post by:
Hi, I used the RugularExpression class in my winforms to validate a textfield. Now I am doing a web application but using a RegularExpressionValidator and I am using the same regex as in my...
7
2217
by: Mike Labosh | last post by:
I have the following System.Text.RegularExpressions.Regex that is supposed to remove this predefined list of garbage characters from contact names that come in on import files : Dim...
3
3958
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
4
1996
by: Marcus | last post by:
Hello, I am trying to include the literal '\' (backslash) character in a regex. I am not sure if I need to escape it, however... From http://www.regular-expressions.info/charclass.html: "To...
2
1256
by: Arthur Dent | last post by:
Hello all, i am trying to write a regex to find escaped characters in a string of the form "\x009" ... to parse strings that look something like this... "My dog jumps\x013\x010" I had that...
31
1752
by: raylopez99 | last post by:
I went through a bunch of Regex examples, and indeed it's quite powerful, including 'groups' using 'matches', word boundaries, lookahead matches, replacing and splitting text,etc--apparently...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7012
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7392
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5479
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.