You can match a pattern in a string using the [[$string =~ $pattern]] conditional expression or by using commands like grep, sed, or awk with appropriate regex patterns.