Skip to content

Instantly share code, notes, and snippets.

View ssta604's full-sized avatar

Sean Stalker ssta604

View GitHub Profile
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.
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",
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+")