Match specific lines in VB.net

Total Post:96

Points:676

VB.Net 
 1598  View(s)
Ratings:
Rate this:

Is there a shorter way of writing this with or without regex?

Dim q1 = System.Text.RegularExpressions.Regex.Match(myString, 

       "[\n\r]finished", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
If (q1.Success) Then Exit Sub
  1. Re: Match specific lines in VB.net

    Yes:

    Imports System.Text.RegularExpressions
    If (Regex.IsMatch(SubjectString, "(?i)\nfinished")) Then Exit Sub

    (it should be enough to check for \n  unless you're also targeting old Macs (pre-OS X) files that only use \r for newlines)

      Modified On Mar-31-2018 05:08:57 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.