what is the difference between this regular expressions are the replaceable?
((?:[^\"])*)
([^\"]*)
background to this question:
The javascript WYSIWYG editor (tinymce) fails to parse my html code in Firefox (23.0.1 and 25.0a2) but works in in Chrome.
I found the regular expression to blame:
attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g;
which I modified, replacing
((?:[^\"])*)
with
([^\"]*)
and
((?:[^\'])*)
with
([^\']*)
the resulting regular expression is working in both browsers for my test case
attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"([^\"]*)\")|(?:\'([^\']*)\')|([^>\s]+)))?/g
can someone put some light on that?
my test data that only works with the modified regular expression is a big image >700 kb like:
var testdata = '<img alt="" src="data:image/jpeg;base64,/9j/4AAQSkZJRgA...5PmDk4FOGOHy6S3JW120W1uCJ5M0PBa54edOFAc8ePX/2Q==">'
doing something like that to test:
testdata.match(attrRegExp);
especially when the test data is big the unmodified regex is likely to fail in firefox.
You can find the jsfiddle example here: