You need anchor the regex to the end of the string to check if the last part of the string is bar optionally followed by a slash.
Your regex effectively matches any string containing bar not followed by a dot.$string =~ m|bar/?$/;
In reply to Re: URL Regex Matching, again
by iburrell
in thread URL Regex Matching, again
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |