SyntaxFix
Write A Post
Hire A Developer
Questions
Using the =~ operator:
=~
$ string="hello-world" $ prefix="hell" $ suffix="ld" $ [[ "$string" =~ ^$prefix(.*)$suffix$ ]] && echo "${BASH_REMATCH[1]}" o-wor