Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to do this in Visual Studio 2010 RegEx?
    primarykey
    data
    text
    <p>I'm tasked with taking about 50 old VB6 functions and subroutines and translating them to C#. They're all pretty straightforward and I find that the majority of the work is manual editing - taking an expression like</p> <pre><code>Dim rtb As Integer </code></pre> <p>and typing </p> <pre><code>int rtb = 0; </code></pre> <p>It occurred to me that there might be some way to automate this using Regular Expressions in Visual Studio's Quick Replace dialog. The idea would be to replace all instances of the first expression, where "rtb' would be some sort of wildcard, with the second expression inserting that wildcard value in indicated spot. But I don't know regex very well so it wasn't obvious to me.</p> <p>Could someone please tell me if this is do-able and indicate the correct syntax for Visual Studio's version of regex?</p> <p><strong>Edit:</strong> I tried two online converters, <a href="http://converter.telerik.com/" rel="nofollow">Telerik</a> and <a href="http://www.developerfusion.com/tools/convert/vb-to-csharp/" rel="nofollow">DeveloperFusion</a>. I pasted in </p> <pre><code>Dim FF As Integer Dim rc As Variant Dim rtb As Integer </code></pre> <p>and in both cases got the same error: -- <strong>line 1 col 1: EOF expected</strong><br> Interestingly, if I manually type the code in they seem to work fine. I tried pasting from Visual Basic, Visual Studio and from Notepad. I tried adding leading or trailing spaces and adding a leading crlf with no effect except that the indicated line and column were always the first non-blank line.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload