using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(`{3}.*[\n\r][^]*?^`{3})";
string input = @"Find: `^(.*)`
Replace: `Prefix-\1`
```
1
2
3
```
Into:
```
Prefix-1
Prefix-2
Prefix-3
```
Thanks. That’s handy, but I’m not likely to remember it (regex not my thing), whereas an action can be named and easily run.
I’ve been thinking about this for while. It’s similar to other Drafts actions I’ve written, so I took some of that code and built [this](https://actions.getdrafts.com/a/17N).";
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