# Basic syntax:
$your_string =~ /regex pattern to match/
# Use !~ for not matching
# Example usage:
# Check if the regex pattern your is found in the variable $your_string
my $your_string = "this is your string";
if ($your_string =~ /your/) {
print "your_string contains your
"
}
--> your_string contains your
# Check if the regex pattern y?o*u+r is found in the variable $your_string
my $your_string = "this is your string";
if ($your_string =~ /y?o*u+r/) {
print "your_string matches pattern
"
}
--> your_string matches pattern
# Where, in regex:
# - ? matches 0 or 1 of the preceeding characters
# - * matches 0 or more of the preceeding characters
# - + matches 1 or more of the preceeding characters