473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

regex to convert j to character

Mo
Hi,

What is the regex to replace & # 1 0 6 ; to character? Any Ideas?

Thanks,
Mo

Feb 15 '07 #1
2 1916

Mo wrote:
Hi,

What is the regex to replace & # 1 0 6 ; to character? Any Ideas?

Thanks,
Mo
Wherefore is a regex here?

someString.Replace("j", "j");

Feb 15 '07 #2
Hi,
>
What is the regex to replace & # 1 0 6 ; to character? Any Ideas?

Thanks,
Mo
You can't "replace" with regex, only "find" (which can then be used to "replace").

Try this to replace all &#<number>; codes with the correct character:

private static string DecodeMatch(Match m)
{
string s = m.ToString(); // "&#" 0-9 ";"
string s2 = s.Substring(2, s.Length-3);
int i = Int32.Parse(s2);
Char c = Convert.ToChar(i);
return c.ToString();
}

public string Decode(string s)
{
string result = Regex.Replace(s, @"&#[0-9]+;",
new MatchEvaluator(Formatter.DeencodeMatch));
return result;
}
Hans Kesting
Feb 15 '07 #3

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

Similar topics

2
by: snthampi | last post by:
I have a C# asp.net project in which I create meta keywords dynamically. I have a problem with "&" character. When the page is rendered, the "&" character is converted into "&amp;". Is there any...
6
by: snt | last post by:
I have a C# asp.net project in which I create meta keywords dynamically. I have a problem with "&" character. When the page is rendered, the "&" character is converted into "&amp;". Is there any...
2
by: BenI | last post by:
Hello, I have a XML file using Iso 8859-1 encoding. Every time when I try to put & character as Tag's value XMLDocument Reader throws Exception. How should I code & character as an ordinary...
11
by: BenI | last post by:
Hello, I have a XML file using Iso 8859-1 encoding. Every time when I try to put & character as Tag's value like <tag>This is & character</tag> Exception is shown in my application. I use...
1
by: Max | last post by:
hi i have stored my connction string in web.config as we do usually. code of web.confing is given below. check the password field contain "&" character. now when i run my application it gives...
0
by: peridian | last post by:
Hi, Can I do a bulk "find and replace" on data in SQL Server to convert character set data? I have data coming in from multiple external sources. That data is not always in UTF-8 or ASCII...
2
by: iffizin | last post by:
how to convert character to date. writetime is character data type. i want to have CPU utilization of last 24 hrs. for time being i want to have result from 1 server. select...
40
by: Tameem | last post by:
hi my name is tameem. i am a new c programmer. in a c program i want to give input ""tameem"" and the output will be ""xdphhp"" in a short: the character ""a"" will be replaced by ""d"" i can...
2
by: christopher taylor | last post by:
hello python-list! the other day, i was trying to match unicode character sequences that looked like this: \\uAD0X... my issue, is that the pattern i used was returning:
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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,...
0
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...
0
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...

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.