Skip to content

Instantly share code, notes, and snippets.

@igrek8
Last active November 25, 2019 11:51
Show Gist options
  • Save igrek8/583296f7d77b65dba601fc39b560e923 to your computer and use it in GitHub Desktop.
Save igrek8/583296f7d77b65dba601fc39b560e923 to your computer and use it in GitHub Desktop.
match markdown code block
(?:^`{3})(?:(.*$\n)?((?:.|\n)*?))(?:`{3}$)
The code in blocks will be matched
```js
var arr = [1, 2, 3];
console.log(1, 2, 3);
```
Unknown block
```
#include <iostream>
#include <string>
struct A {
int val;
void print() {
std::cout << this - > val << std::endl;
}
};
int main() {
A * a = new A();
( * a).val = 100;
}
```
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
</body>
</html>
```
And so on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment