This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text.RegularExpressions; | |
using System.Linq; | |
/// <summary> | |
/// Helper class for handling regular expressions. | |
/// </summary> | |
public static class RegExHelper | |
{ | |
/// <summary> | |
/// Finds matches in the input text based on the search text, treating each word in the search text as a separate pattern. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
var output = | |
Enumerable.Range(1, 50) | |
.Select<int, string>((num) => num + ": " + (num % 3 == 0, num % 5 == 0) | |
switch | |
{ | |
(true, true) => "FizzBuzz", | |
(true, false) => "Fizz", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Text.RegularExpressions | |
Public Class RegExHelper | |
Public Shared Function GetRegExMatches(ByVal inputText As String, ByVal searchText As String) As MatchCollection | |
If String.IsNullOrWhiteSpace(searchText) Then | |
Return Nothing | |
End If | |
Dim lSafeSearchText As String | |
'Break apart the search into string array split by one or more space | |
Dim lWords() As String = Regex.Split(searchText, "\s+") |