Code Snippets

Tag: Regex

Find and Replace with sed

Edit a file in place with sed -i, replacing matches globally.

Author: chris

Regex with re.search

Use named groups with the re stdlib and access them via groupdict().

Author: chris

Regex with Match Groups

Use named capture groups with the /g flag and matchAll.

Author: chris

PCRE Regex in PHP

Use preg_match with named groups to parse structured text.

Author: chris

Regex FindAllString in Go

Compile a regex and pull every match out of a string.

Author: chris