---
# System prepended metadata

title: Regex
tags: [regex]

---

---
title: "Regex"
path: "Regex"
---

{%hackmd @RintarouTW/About %}

# Regex

https://regexr.com/

## Lookahead

```
s/\$\$(?=.)/$$\n/g
search $$. but not include the last character,
replace $$ to $$\n
```

## Lookbehind

```
s/(?<=.)\$\$/$$\n/g

search .$$, but not include the first character,
replace $$ to \n$$
```

Helper regex to convert format for KaTeX.

Required for KaTeX
- convert {align} to {aligned}
- replace _\limits with \limits\_

## Image URL 

```
/(https:)([/|.|\w|\s|-])*\.(?:jpg|gif|png|svg)/
```


###### tags: `regex`