I think an effective way, is to match all attributes regardless of quoting style and allow inner quotes within scriptlets.
private static final Pattern ATTRIBUTES_PATTERN = Pattern.compile(
"(\\w+)\\s*=\\s*(\"((?:[^\"\\\\]|\\\\.)*?)\"|'((?:[^'\\\\]|\\\\.)*?)')"
);