bronze_0_1 1175432452 learn Binary operator, uses the expression on the right hand side as an extended regular expression and returns true if the expression on the left hand side matches the pattern. example if [[ "foofoo" =~ "foo*" ]] ; then echo its foo; else echo No foo; fi bronze_0_1 1175433898 forget bronze_0_1 1175433917 learn Binary operator, uses the expression on the right hand side as an extended regular expression and returns true if the expression on the left hand side matches the pattern. example if [[ "foofoo" =~ foo* ]] ; then echo its foo; else echo No foo; fi igli 1198309838 forget igli 1198309930 learn Binary operator, uses the expression on the right hand side as an extended regular expression and returns true if the expression on the left hand side matches the pattern. USE A VARIABLE to hold your regexes. eg if [[ $var =~ $r ]] && echo Match || echo 'No match' igli 1198309945 forget igli 1198309967 learn Binary operator, uses the expression on the right hand side as an extended regular expression and returns true if the expression on the left hand side matches the pattern. USE A VARIABLE to hold your regexes. eg: [[ $var =~ $r ]] && echo Match || echo 'No match' geirha 1271429626 forget Riviera 1271429637 learn Binary operator, uses the expression on the right hand side as an extended regular expression and returns true if the expression on the left hand side matches the pattern. USE A VARIABLE to hold your regexes: if [[ $var =~ $r ]]; then echo Match; else echo 'No match'; fi ormaaj 1358918976 forget ormaaj 1358919410 learn ''=~'' is a binary operator used within Bash or ksh93 test expression compound commands ''[['' to perform pattern matching with extended regular expressions (ERE). Regex grouping may be done with the BASH_REMATCH array (bash) or .sh.match (ksh93) variables. Older buggy versions of Bash require storing the regex in a variable. ksh93 can use ERE elsewhere using the ~(E) pattern operator. You may not use ormaaj 1358919592 forget ormaaj 1358919733 learn ''=~'' is a binary operator used within Bash or ksh93 test expressions ''[['' to match extended regular expressions (ERE). Regex grouping may be done with the BASH_REMATCH array (bash) or .sh.match (ksh93) variables. Older buggy versions of Bash require storing the regex in a variable. ksh93 can use ERE elsewhere via the ~(E) operator. You can't use =~ (or ==) with ''[''. lhunath 1361240320 forget lhunath 1361240549 learn The =~ operator of [[ evaluates the left hand string against the right hand extended regular expression (ERE). After a successful match, BASH_REMATCH can be used to expand matched groups from the pattern. Quoted parts of the regex become literal. To be safe & compatible, put the regex in a parameter and do [[ $string =~ $regex ]] yitz_ 1457377681 forget yitz_ 1457377689 learn The =~ operator of [[ evaluates the left hand string against the right hand extended regular expression (ERE). After a successful match, BASH_REMATCH can be used to expand matched groups from the pattern. Quoted parts of the regex become.. yitz_ 1457377702 forget yitz_ 1457377703 learn The =~ operator of [[ evaluates the left hand string against the right hand extended regular expression (ERE). After a successful match, BASH_REMATCH can be used to expand matched groups from the pattern. Quoted parts of the regex become literal. To be safe & compatible, put the regex in a variable and do [[ $string =~ $regex ]] greycat 1556642754 forget greycat 1556642755 learn The =~ operator of [[ evaluates the left hand string against the right hand ERE (see , ). After a successful match, the BASH_REMATCH array contains the matched string and subexpressions (if any). Any quoted characters in the ERE become literal. Best to put the whole ERE in a variable: [[ $string =~ $regex ]]