This website is released under |
Regular ExpressionsExamples of use
# colour matched substrings # see also: Built-in Shell Variables (and Arrays) RED='\033[1;31m' NC='\033[0m' tmp_string="${string}" while [[ "${tmp_string}" =~ (.*)(${REGEX})(.*) ]]; do tmp_string="${BASH_REMATCH[1]}${BASH_REMATCH[3]}" string="${BASH_REMATCH[1]}${RED}${BASH_REMATCH[2]}${NC}${string/${BASH_REMATCH[1]}${BASH_REMATCH[2]}/}" done echo -e "${string}" Examples of regexISO 8601 date and time format
# the current date in the YYYY-mm-dd format REGEX="$(date +'%Y-%m-%d')" REGEX="$(date +'%F')" # "valid" date of the current year in the YYYY-mm-dd format REGEX="$(date +'%Y')-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])" # "valid" date between 1970-01-01 and 2025-12-31 REGEX="(19[7-9][0-9]|20[01][0-9]|202[0-5])-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])" Container for ProRes 422 and 4444 encoded videoREGEX='^(mov|mkv|mxf)$' LTO cartridge barcode
Version of a BagIt File Packaging FormatREGEX="^1.0|0.9[3-7]$" 2025-10-24 |