Just escape the dashes to prevent them from being interpreted (I don’t think underscore needs escaping, but it can’t hurt). You don’t say which regex you are using.
([A-Za-z0-9\-\_]+)
More Related Contents:
- Regex: match everything but a specific pattern
- Regex lookahead, lookbehind and atomic groups
- Regular Expression for alphanumeric and underscores
- How to match multiple occurrences of a substring
- Find and kill a process in one line using bash and regex
- Regular expression to match standard 10 digit phone number
- Regex: matching up to the first occurrence of a character
- Convert a char to upper case using regular expressions (EditPad Pro)
- Regex: Remove lines containing “help”, etc
- How to check if a line is blank using regex
- Match linebreaks – \n or \r\n?
- Notepad++ incrementally replace
- How would I import YouTube Likes and Dislikes and a ratio from YouTube onto Google Sheets? [closed]
- What is the complexity of regular expression?
- Remove .php from urls with htaccess
- R dplyr: rename variables using string functions
- What does ?= mean in a regular expression?
- Regular Expressions with repeated characters
- Why do ^ and $ not work as expected?
- Is there an online RegexBuddy-like regular expression analyzer? [closed]
- Regular Expression Match to test for a valid year
- How can I insert a tab character with sed on OS X?
- Searching for all variations of hyphens and dashes in Regex
- How do I remove all non-ASCII characters with regex and Notepad++?
- “Unknown escape sequence” error in Go
- How do I use a new-line replacement in a BSD sed?
- Test for numeric elements in a character string
- Remove everything except a certain pattern
- RegEx for allowing alphanumeric at the starting and hyphen thereafter
- How does \b work when using regular expressions?