I want to check in Adobe AIR if a regular expression is specified. I am looking for somtehing similar here: How to check if a given regex is valid?
I do not want to compare regular expression and text value. i jus wants to check if this is a regular expression. If someone typed an invalid regular expression - for example: "x {5, -3}" or "((^^ $$$) //)" or something like this, I just need to tell him that this is regular the expression is not valid - its an incorrect regular expression.
In Java, this can be done: [Code]
try {
Pattern.compile(userInputPattern);
} catch (PatternSyntaxException exception) {
System.err.println(exception.getDescription());
System.exit(1);
}
[/the code]
source
share