String Literal in VB.NET?
-
hey all, I'm trying to do a very simple regular expression but VS.NET is barking at a simple line of code. At the top I have:
Imports System.Text.RegularExpressions
And in my code I have:Dim r As Regex() r = New Regex("\d{2}[a-zA-Z]+", RegexOptions.IgnoreCase Or RegexOptions.Compiled)
The error message is: C:\DavidCode\NETBeast\WindowsApplication2\Form1.vb(74): Value of type 'System.Text.RegularExpressions.Regex' cannot be converted to '1-dimensional array of System.Text.RegularExpressions.Regex'. I'm not sure I understand why except that my regex may not be a string literal. In C# I can just do @"..." but in VB.NET it isn't working.. :eek: *->>Always working on my game, teach me *->>something new. cout << "dav1d\n"; -
hey all, I'm trying to do a very simple regular expression but VS.NET is barking at a simple line of code. At the top I have:
Imports System.Text.RegularExpressions
And in my code I have:Dim r As Regex() r = New Regex("\d{2}[a-zA-Z]+", RegexOptions.IgnoreCase Or RegexOptions.Compiled)
The error message is: C:\DavidCode\NETBeast\WindowsApplication2\Form1.vb(74): Value of type 'System.Text.RegularExpressions.Regex' cannot be converted to '1-dimensional array of System.Text.RegularExpressions.Regex'. I'm not sure I understand why except that my regex may not be a string literal. In C# I can just do @"..." but in VB.NET it isn't working.. :eek: *->>Always working on my game, teach me *->>something new. cout << "dav1d\n";It's because of those parentheses after Dim r As Regex. What you're saying here is "give me an array of Regexes" then you're saying assign this new Regex to this array variable which just isn't possible. Paul
-
It's because of those parentheses after Dim r As Regex. What you're saying here is "give me an array of Regexes" then you're saying assign this new Regex to this array variable which just isn't possible. Paul