RegexOptionBitsConstants

Description

Constant object that contains bits for Regex.Compile() options. Values can be combined using bit or operator "|".

Technical Details

SBM ModScript version: 11.3.

Example

var regex = Regex();
//To test for a valid phone number
var subCheck = "(\\+\\d{1,2}\\s*)?\\(?\\d{3}\\)?\\s*[\\.-]?\\s*\\d{3}\\s*[\\.-]?\\s*\\d{4}";
var testNumbers = 
"123-456-7890 | 
(123)456-7890 | 
123 456 7890 | 
123,456,7890 | 
+91 (123) 456-7890";
regex.Compile(subCheck, RegexOptionBitsConstants.IGNORECASE | 
    RegexOptionBitsConstants.MULTILINE);
if ( regex.Matches(testNumbers) ) {
  Ext.WriteStream("Matches:<br />${regex.GroupVal(0)}");
	 while( regex.MatchesAgain() ) {
		  Ext.WriteStream("<br />${regex.GroupVal(0)}");
	 }
}

Result:

Matches:
123-456-7890
(123)456-7890
123 456 7890
+91 (123) 456-7890 

Related Topics

Constants

Regex