473,469 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2015
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...
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
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...
1
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
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
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.