473,385 Members | 1,341 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,385 software developers and data experts.

C# string to VB conversion.

I have the following C# string that I need to use in a regular expression for
VB. Does anyone know how I might convert this?

"\<td(\s+(?<Attribute>(?<key>[A-Za-z0-9]+)\s*=\s*""(?<value>[^""]*)""))+\>(?<Message>[A-Za-z0-9 <>,:?.]*)\</td\>"

Thank you.

Kevin
Nov 21 '05 #1
3 941
=?Utf-8?B?S2V2aW4gQnVydG9u?= <Ke*********@discussions.microsoft.com>
wrote in news:50**********************************@microsof t.com:
I have the following C# string that I need to use in a regular
expression for VB. Does anyone know how I might convert this?

"\<td(\s+(?<Attribute>(?<key>[A-Za-z0-9]+)\s*=\s*""(?<value>[^""]*)""))
+\>(?<Message>[A-Za-z0-9 <>,:?.]*)\</td\>"

Thank you.

Looks fine... it should work in VB.NET. Maybe replace the spaces with \s?
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #2
When I use this string in the constructor for a regular expression:

Set oRegExp = New
RegExp("\<td(\s+(?<Attribute>(?<key>[A-Za-z0-9]+)\s*=\s*""(?<value>[^""]*)""))+\>(?<Message>[A-Za-z0-9 <>,:?.]*)\</td\>", RegexOptions.MultiLine)

I get:

VBScript compilation error: Expected end of statement(377,37)

The 37 (character count) seems to refer to the beginning of the string so
that is not helpful. 377 (line number) definitely points to this line. When I
remove the only space (in the Message capture group) in the string I still
get the same error so there is something else that is wrong with the string
as far as VB is concerned.

Thank you for your suggestions.

Kevin

"Lucas Tam" wrote:
=?Utf-8?B?S2V2aW4gQnVydG9u?= <Ke*********@discussions.microsoft.com>
wrote in news:50**********************************@microsof t.com:
I have the following C# string that I need to use in a regular
expression for VB. Does anyone know how I might convert this?

"\<td(\s+(?<Attribute>(?<key>[A-Za-z0-9]+)\s*=\s*""(?<value>[^""]*)""))
+\>(?<Message>[A-Za-z0-9 <>,:?.]*)\</td\>"

Thank you.

Looks fine... it should work in VB.NET. Maybe replace the spaces with \s?
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 21 '05 #3
=?Utf-8?B?S2V2aW4gQnVydG9u?= <Ke*********@discussions.microsoft.com>
wrote in news:6A**********************************@microsof t.com:
When I use this string in the constructor for a regular expression:

Set oRegExp = New
RegExp("\<td(\s+(?<Attribute>(?<key>[A-Za-z0-9]+)\s*=\s*""(?<value> [^"" ]*)""))+\>(?<Message>[A-Za-z0-9 <>,:?.]*)\</td\>",
RegexOptions.MultiLine)

I get:

VBScript compilation error: Expected end of statement(377,37)

The 37 (character count) seems to refer to the beginning of the string
so that is not helpful. 377 (line number) definitely points to this
line. When I remove the only space (in the Message capture group) in
the string I still get the same error so there is something else that
is wrong with the string as far as VB is concerned.


I see it now, You need to quardruple up your quotes! """" = " within a
string

Sort of ugly huh?


--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #4

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

Similar topics

10
by: Marcin Kalicinski | last post by:
Why string literals are regarded as char * not as const char *? (1) void f(char *); (2) void f(const char *); f("foo") will call version (1) of function f. I understand that the exact type...
2
by: Thomas Matthews | last post by:
Hi, I'm working with Borland C++ Builder 6.2. My project uses the std::string class. However, Borland in its infinite wisdom has its own string class, AnsiString. To make my life easier, I...
12
by: ABeck | last post by:
Hello List, I have ar more or less academical question. Can there arise runtime errors in a program, if the include of <string.h> has been forgotten? If all the arguments to the functions of...
6
by: Marco Herrn | last post by:
Hi, I need to serialize an object into a string representation to store it into a database. So the SOAPFormatter seems to be the right formatter for this purpose. Now I have the problem that...
6
by: tommaso.gastaldi | last post by:
Hi, does anybody know a speedy analog of IsNumeric() to check for strings/chars. I would like to check if an Object can be treated as a string before using a Cstr(), clearly avoiding the time...
4
by: Russell Warren | last post by:
I've got a case where I want to convert binary blocks of data (various ctypes objects) to base64 strings. The conversion calls in the base64 module expect strings as input, so right now I'm...
10
by: =?Utf-8?B?RWxlbmE=?= | last post by:
I am surprised to discover that c# automatically converts an integer to a string when concatenating with the "+" operator. I thought c# was supposed to be very strict about types. Doesn't it seem...
5
by: jeremyje | last post by:
I'm writing some code that will convert a regular string to a byte for compression and then beable to convert that compressed string back into original form. Conceptually I have.... For...
3
by: Kevin Frey | last post by:
I am porting Managed C++ code from VS2003 to VS2005. Therefore adopting the new C++/CLI syntax rather than /clr:oldSyntax. Much of our managed code is concerned with interfacing to native C++...
10
by: Dancefire | last post by:
Hi, everyone, I'm writing a program using wstring(wchar_t) as internal string. The problem is raised when I convert the multibyte char set string with different encoding to wstring(which is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...

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.