[フレーム]
Last Updated: February 25, 2016
·
401
· knuthaug

Matching regexps directly in bash

It may be old news to everyone, but again, it may not.

#!/bin/bash

regxp="[a-z]+[0-9]*"

if [[ $string =~ $regexp ]]
then
 #do stuff
fi

AltStyle によって変換されたページ (->オリジナル) /