I’ve come across quite a few regex patterns which break compilation. Here’s 
some examples:

private static const _newLineTabPattern:RegExp = /[\u0009\u000a\u000d]/g;
static private const brRegEx:RegExp = /\u2028/;
private static const _newLineRegex:RegExp = /\u000A|\u000D\u000A?/g;
public static const anyPrintChar:RegExp = /[^\u0009\u000a\u000d\u0020]/g;
public static const attrRegex:RegExp = 
/\s+(\w+)(?:\s*=\s*(".*?"|'.*?'|[\w\.]+))?/sg;
public static const tagRegex:RegExp = 
/<(\/?)(\w+)((?:\s+\w+(?:\s*=\s*(?:".*?"|'.*?'|[\w\.]+))?)*)\s*(\/?)>/sg;
public static const stripRegex:RegExp = 
/<!--.*?-->|<\?(".*?"|'.*?'|[^>"']+)*>|<!(".*?"|'.*?'|[^>"']+)*>/sg;

The last three have to do with unsupported flags, but the first four break 
simply because the compiler evaluates the strings and they become spaces and 
line breaks, etc.

What can we do to prevent the compiler from killing patterns during compilation?

Harbs

Reply via email to