简体   繁体   中英

VB.NET - How I can use this var like a RegEx?

I need to use a var called "caracter" as "Char" type like a regexp, in this example:

 If CheckboxN.Name.Contains(caracter) Then...

This is the interpretation of the example above in Ruby if someone don't understand my intentions:

If CheckboxN.Name[(/^#{Regexp.escape(caracter)}$/)] Then...

Thankyou for read.

Take a look at the Regex.Match() Method .


 Dim reg As New Regex(character)
 If reg.IsMatch(CheckboxN.Name) Then
     'Do Stuff...
 End If

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM