'What does the d flag mean in a javascript RegEx?
I have a regex, that appears to work in Safari and Chrome that gives the following error in FireFox.
Error: invalid regular expression flag d
Source File: http://java.net/projects/mq
Line: 194, Column: 34
Source Code:
var vbkpatt1=/projects\/[^/]+/di;
I had fought with this RegEx a couple weeks ago and had put it aside, so I do not have a link to the page that led me to use the 'd' flag. A pointer to a ref that includes the d flag would be a solid start to resolving my issue.
Solution 1:[1]
There is no d flag, which is your issue :) There are:
g- Global search (multiple matches)i- Case insensitivem- Multiple input
Solution 2:[2]
Are you sure it actually does something in Chrome? I tried:
/projects\/[^/]+/zyx
It accepts that as /projects\/[^/]+/, but I strongly doubt those are all real extensions. It's just ignoring them. as noted by Ken, it will keep valid flags even if invalid ones are present.
Also, I recommend you follow a good tutorial, rather than just cutting and pasting.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Community |
| Solution 2 |
