Plus is a special character in regular expressions, so to express the character as data you must escape it by prefixing it with \
.
var reg = /d\+1/;
More Related Contents:
- What’s the best way to validate an email address in JavaScript?
- Why this javascript regex doesn’t work?
- Converting user input string to regular expression
- Regular Expression for password validation
- Recursive matching with regular expressions in Javascript
- How to find indices of all occurrences of one string in another in JavaScript?
- How can I match multiple occurrences with a regex in JavaScript similar to PHP’s preg_match_all()?
- Converting any string into camel case
- Return positions of a regex match() in Javascript?
- How to split a long regular expression into multiple lines in JavaScript?
- Works in Chrome, but breaks in Safari: Invalid regular expression: invalid group specifier name /(?
- Javascript – return string between square brackets
- How to prevent Javascript injection attacks within user-generated HTML
- regex street address match
- regex javascript to match both RGB and RGBA
- jQuery Youtube URL Validation with regex
- Replace function not replacing [duplicate]
- Include Arabic characters in JavaScript regular expression?
- Optimize long lists of fixed string alternatives in regex
- Replace certain arabic words in text string using Javascript
- What does the “Nothing to repeat” error mean when using a regex in javascript?
- Regular expression for number with length of 4, 5 or 6
- Use RegExp to match a parenthetical number then increment it
- Regex JavaScript image file extension [closed]
- Removing backslashes from strings in javascript
- Why this regex is not working for german words?
- Remove everything within script and style tags
- I would like to mimick conditionals in javascript regex
- Get text between two rounded brackets
- Preg_match to regex equivalent expression to match any Unicode letters