Skip to content

Instantly share code, notes, and snippets.

@mrlacey
Created November 17, 2020 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrlacey/6b35af1d187742c445ded263d07e09dc to your computer and use it in GitHub Desktop.
Save mrlacey/6b35af1d187742c445ded263d07e09dc to your computer and use it in GitHub Desktop.
FestiveEditor - 8
internal sealed class FestiveImageTagger : RegexTagger<FestiveImageTag>
{
internal FestiveImageTagger(ITextBuffer buffer)
: base(
buffer,
new[] { new Regex(@"\W(\w{3,7})\W", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase) })
{
}
protected override FestiveImageTag TryCreateTagForMatch(Match match)
{
if (match.Groups.Count == 2)
{
var term = match.Groups[1].Value;
return new FestiveImageTag(term);
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment