tag searching

Published on Tue Mar 01 2022

Additional matching regexes for
tag searching

Convert YYMMDD to DD/MM/YY

I'm new to regular expressions and I've been searching high and low for this really simple date conversion from YYMMDD to DD/MM/YY e.g. 140923 to 23/09/14. Maybe I just didn't search hard enough, but here goes: Search/original string: (\d{4})(\d{2})(\d{2}) Replace string $3/$2/$1

Parser for GPG search-key output

Record the output of the batch `gpg --search-keys` commands into variables. For example, get the public key ids or those with `*.amazon.com` email addresses: pubkeyids=$(gpg --batch --keyserver hkp://keyserver.ubuntu.com --search-keys amazon.com 2>&1 | grep -Po '\d+\s*bit\s*\S+\s*key\s*[^,]+' | cut -d' ' -f5) We can automate searching for keys and adding them to the keyring using `bash` parsing that output. As an illustration, I created [the following GitHub gist][1] to host the code below. [1]: https://gist.github.com/mavaddat/a81627ec4680ef5d6c30a9ebdc412037

Matches human genomic coordinates

This expression matches human genomic coordinates, similat to those being used by genome browsers (e.g. the UCSC Genome Browser). It can match: chromosome, chromosome start, chromosome start end, chromosome start end reference sequence, chromosome start end reference sequence alternative sequence. The last two are useful when searching for mutations. Examples: 1 # matches chromosome 1 chr1 # matches chromosome 1 1:12345 # matches chromosome 1, start at base 12345 chr11:12345-78900 # matches chromosome 1, start at base 12345, end at base 78900 chr11 12345 78900 # matches chromosome 1, start at base 12345, end at base 78900 11:12345-12345_A/G # matches chromosome 1, start at base 12345, end at base 12345 and a substitution of A to G 11 12345 12347 AG GC # matches chromosome 1, start at base 12345, end at base 12345 and a substitution of AG to GC