---
title: "Match specific lines in VB.net"  
description: "Match specific lines in VB.net"  
author: "Anonymous User"  
published: 2013-10-05  
updated: 2013-10-05  
canonical: https://www.mindstick.com/forum/1595/match-specific-lines-in-vb-dot-net  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 1 minute  

---

# Match specific lines in VB.net

Is there a shorter way of [writing](https://www.mindstick.com/articles/12997/5-essential-tips-on-resume-writing-for-business-analysts) this with or without [regex](https://www.mindstick.com/forum/160352/how-to-use-regex-in-javascript-for-pattern-matching)?

```
Dim q1 = System.Text.RegularExpressions.Regex.Match(myString,
       "[\n\r]finished", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
If (q1.Success) Then Exit Sub
```

## Replies

### Reply by Anonymous User

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)


---

Original Source: https://www.mindstick.com/forum/1595/match-specific-lines-in-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
