473,406 Members | 2,377 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,406 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 2013
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
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,...

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.