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

Help converting C# Regular Expression to VB.Net??

Hi All.

I'm using some C# code which I translated to vb.net to remove
sourcesafe information from project and solution files. It uses regular
expressions, and the attempt I made at translating the c~ expression
doesn't produce the required results.....

Could some have a look at this and point out where I've gone wrong?

C# Code:
Regex r = new Regex("\\\"Scc\\w*\\\"\\s*=\\s*\\\".*\\\"");

and my stab at VB.Net Code:
Dim objRegEx As New Regex("\\""Scc\w*\\""\s*=\s*\\"".*\\""")

and a second expression:
C# Code:
Regex r = new Regex("Scc\\w*\\s*=\\s*\\\".*\\\"");

and my stab at VB.Net Code:
Dim objRegEx As New Regex("Scc\w*\s*=\s*\\"".*\\""")

Thanks

Alex

Jul 21 '05 #1
2 2011
Its a little tricky not knowing your original intended expression, but
I'll take a stab.

My guess at the VB.NET for the first one would be:
New Regex("\""Scc\w*\""\s*=\s*\"".*\""")

and the second:
New Regex("Scc\w*\s*=\s*\"".*\""")

Note, C# uses \" to represent " while VB.NET uses ""
And C# uses \\ to represent \ while VB.NET does not need to escape a \

If you don't want to escape \ in C#, you can add a @ before the string.
For example:
Regex("\\w*")
can be re-written as
Regex(@"\w*")
Hope that helps.

Joshua Flanagan
http://flimflan.com/blog
al*********@gcc.co.uk wrote:
Hi All.

I'm using some C# code which I translated to vb.net to remove
sourcesafe information from project and solution files. It uses regular
expressions, and the attempt I made at translating the c~ expression
doesn't produce the required results.....

Could some have a look at this and point out where I've gone wrong?

C# Code:
Regex r = new Regex("\\\"Scc\\w*\\\"\\s*=\\s*\\\".*\\\"");

and my stab at VB.Net Code:
Dim objRegEx As New Regex("\\""Scc\w*\\""\s*=\s*\\"".*\\""")

and a second expression:
C# Code:
Regex r = new Regex("Scc\\w*\\s*=\\s*\\\".*\\\"");

and my stab at VB.Net Code:
Dim objRegEx As New Regex("Scc\w*\s*=\s*\\"".*\\""")

Thanks

Alex

Jul 21 '05 #2
Joshua,

Thanks for you help, that did the trick.

Alex

Jul 21 '05 #3

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

Similar topics

9
by: Steve | last post by:
Hello, I am writing a script that calls a URL and reads the resulting HTML into a function that strips out everthing and returns ONLY the links, this is so that I can build a link index of various...
5
by: Bradley Plett | last post by:
I'm hopeless at regular expressions (I just don't use them often enough to gain/maintain knowledge), but I need one now and am looking for help. I need to parse through a document to find a URL,...
4
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go...
2
by: alexstevens | last post by:
Hi All. I'm using some C# code which I translated to vb.net to remove sourcesafe information from project and solution files. It uses regular expressions, and the attempt I made at translating...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
3
by: Zach | last post by:
Hello, Please forgive if this is not the most appropriate newsgroup for this question. Unfortunately I didn't find a newsgroup specific to regular expressions. I have the following regular...
2
by: swarnap | last post by:
I have to generate a regular expression dynamically to check the file extensions. The file extension types are stored in a model data which are are to be fetched in form of a string and set into an...
4
by: vishal | last post by:
Hello All: I am trying to work out a regular expression in a PyQt environment for time in hh:mm:ss format. Any suggestions? Thanks, Vishal
8
by: Martin Nadoll | last post by:
hello, i need a regular expression for my form-validation: it should be allowed to fill a <input type="text"with any iteger number up to 500 or a integer number up to 500 followed by px...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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
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...

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.