SyntaxFix
Write A Post
Hire A Developer
Questions
Your expression should already match dashes, because the final - will not be interpreted as a range operator (since the range has no end). To add underscores as well, try:
([A-Za-z0-9_-]+)