Code Snippets

Category: Strings & Text

Filter Columns with awk

Print specific columns and filter by a numeric threshold.

Author: chris

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

URL Encode and Decode in PHP

rawurlencode is RFC 3986; urlencode uses the older application/x-www-form-urlencoded.

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

URL Encode and Decode in Perl

Use URI::Escape for percent-encoding and decoding strings.

Author: chris