using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\s*\{\{ site\.data\.variables\.product\.prodname_desktop \}\}\s(.*)[^|\n]$";
string input = @"---
title: Keyboard shortcuts in GitHub Desktop
intro: You can use keyboard shortcuts in {{ site.data.variables.product.prodname_desktop }}.
productVersions:
desktop: '*'
---
{{#mac}}
{{ site.data.variables.product.prodname_desktop }}
GitHub Desktop keyboard shortcuts on macOS
### Site wide shortcuts
| Keyboard shortcut | Description |
| ------------------------------------ | ----------------------------------------------------------------------- |
| <kbd>⌘</kbd><kbd>,</kbd> | Go to Preferences |
| <kbd>⌘</kbd><kbd>H</kbd> | Hide the {{ site.data.variables.product.prodname_desktop }} application
| <kbd>⌥</kbd><kbd>⌘</kbd><kbd>H</kbd> | Hide all other applications |
| <kbd>⌘</kbd><kbd>Q</kbd> | Quit {{ site.data.variables.product.prodname_desktop }} |
| <kbd>⌃</kbd><kbd>⌘</kbd><kbd>F</kbd> | Toggle full screen view |
| <kbd>⌘</kbd><kbd>0</kbd> | Reset zoom to default text size |
| <kbd>⌘</kbd><kbd>=</kbd> | Zoom in for larger text and graphics |
| <kbd>⌘</kbd><kbd>-</kbd> | Zoom out for smaller text and graphics |
| <kbd>⌥</kbd><kbd>⌘</kbd><kbd>I</kbd> | Toggle Developer Tools |
### Repositories
| Keyboard shortcut | Description |
| ------------------------------------ | ----------------------------------------------------------------------------------- |
| <kbd>⌘</kbd><kbd>N</kbd> | Add a new repository |
| <kbd>⌘</kbd><kbd>O</kbd> | Add a local repository |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>O</kbd> | Clone a repository from {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>⌘</kbd><kbd>T</kbd> | Show a list of your repositories |
| <kbd>⌘</kbd><kbd>P</kbd> | Push the latest commits to {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>P</kbd> | Pull down the latest changes from {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>⌘</kbd><kbd>⌦</kbd> | Remove an existing repository |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>G</kbd> | View the repository on {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>⌃</kbd><kbd>`</kbd> | Open repository in your preferred terminal tool |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>F</kbd> | Show the repository in Finder |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>A</kbd> | Open the repository in your preferred editor tool |
### Branches
| Keyboard shortcut | Description |
| ------------------------------------ | ---------------------------------------------------------------------------------- |
| <kbd>⌘</kbd><kbd>1</kbd> | Show all your changes before committing |
| <kbd>⌘</kbd><kbd>2</kbd> | Show your commit history |
| <kbd>⌘</kbd><kbd>B</kbd> | Show all your branches |
| <kbd>⌘</kbd><kbd>G</kbd> | Go to the commit summary field |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>N</kbd> | Create a new branch |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>R</kbd> | Rename the current branch |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>D</kbd> | Delete the current branch |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>U</kbd> | Update from default branch |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>B</kbd> | Compare to an existing branch |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>M</kbd> | Merge into current branch |
| <kbd>⇧</kbd><kbd>⌘</kbd><kbd>C</kbd> | Compare branches on {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>⌘</kbd><kbd>R</kbd> | Show the current pull request on {{ site.data.variables.product.prodname_dotcom }} |
{{/mac}}
{{#windows}}
GitHub Desktop keyboard shortcuts on Windows
### Site wide shortcuts
| Keyboard shortcut | Description |
| ------------------------------------------- | -------------------------------------- |
| <kbd>Ctrl</kbd><kbd>,</kbd> | Go to Options |
| <kbd>F11</kbd> | Toggle full screen view |
| <kbd>Ctrl</kbd><kbd>0</kbd> | Reset zoom to default text size |
| <kbd>Ctrl</kbd><kbd>=</kbd> | Zoom in for larger text and graphics |
| <kbd>Ctrl</kbd><kbd>-</kbd> | Zoom out for smaller text and graphics |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>I</kbd> | Toggle Developer Tools |
### Repositories
| Keyboard Shortcut | Description |
| ------------------------------------------- | ----------------------------------------------------------------------------------- |
| <kbd>Ctrl</kbd><kbd>N</kbd> | Add a new repository |
| <kbd>Ctrl</kbd><kbd>O</kbd> | Add a local repository |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>O</kbd> | Clone a repository from {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>Ctrl</kbd><kbd>T</kbd> | Show a list of your repositories |
| <kbd>Ctrl</kbd><kbd>P</kbd> | Push the latest commits to {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>P</kbd> | Pull down the latest changes from {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>Ctrl</kbd><kbd>Delete</kbd> | Remove an existing repository |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>G</kbd> | View the repository on {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>Ctrl</kbd><kbd>`</kbd> | Open repository in your preferred command line tool |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>F</kbd> | Show the repository in Explorer |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>A</kbd> | Open the repository in your preferred editor tool |
### Branches
| Keyboard shortcut | Description |
| ------------------------------------------- | ---------------------------------------------------------------------------------- |
| <kbd>Ctrl</kbd><kbd>1</kbd> | Show all your changes before committing |
| <kbd>Ctrl</kbd><kbd>2</kbd> | Show your commit history |
| <kbd>Ctrl</kbd><kbd>B</kbd> | Show all your branches |
| <kbd>Ctrl</kbd><kbd>G</kbd> | Go to the commit summary field |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>N</kbd> | Create a new branch |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>R</kbd> | Rename the current branch |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>D</kbd> | Delete the current branch |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>U</kbd> | Update from default branch |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>B</kbd> | Compare to an existing branch |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>M</kbd> | Merge into current branch |
| <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>C</kbd> | Compare branches on {{ site.data.variables.product.prodname_dotcom }} |
| <kbd>Ctrl</kbd><kbd>R</kbd> | Show the current pull request on {{ site.data.variables.product.prodname_dotcom }} |
{{/windows}}";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx