473,624 Members | 2,027 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.r eplace( /\</g, "&lt;" );
source=source.r eplace /\>/g, "&gt;" );

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

source=source.r eplace( /\</g, "&lt;" );
source=source.r eplace /\>/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)cybers pace.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 no idea what I'm doing wrong. What I want to do: - Extract all digits (\d) in a string. - Digits are separated by space (\w)
2
2714
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. Hence I am in need of a regex package for visual studio. I tried http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm but I am having some problems with compilation since I also use
1
1469
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, (charsets value is not consistant) I am having problems with the following regexp, I don't know at compile time what will be after the iso number,I can't seem to be able to
3
1778
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 remove all periods from the end of customer names. However I really need to know how to
3
909
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 winforms. However in my web app it only checks for single chars instead of the complete string. Is there any difference when using regex in Webforms and WinForms?
7
2225
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 _dropContactGarbage As New Regex( _ "(+)|" & _ "(+)|" & _ "(+)|" & _ "(+)|" & _ "(+)|" & _
3
3970
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 a couple of problems, which I'll try to describe. But this e-mail will only reproduce one of them, in a "short" example. What I'm generally doing is having each form entry contained in a div, which as a label, an input with some event handlers,...
4
2009
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 include a backslash as a character without any special meaning inside a character class, you have to escape it with another backslash. matches a backslash or an x."
2
1263
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 working fine, with the regex "\\\d{3}" Now i wanted to extend it so that it would NOT count them when the leading slash is itself, preceeded by a slash (escaped). so this sentence would NOT match... "My dog jumps\\x013\\x010"
31
1778
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 there's a whole book on it, though I just used the chapter in Albahari et al C#3 in a Nutshell (a great book). You can indeed 'massage' a string into a number of ways, but, at the end of the process I found that you still have to go through the...
0
8236
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8173
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8679
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8621
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4079
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2606
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.