class_docstr: Validator for regular expressions.
class_docstr_tok: ["Validator","for","regular","expressions","."]
docstr: Init.
  
  Note, that if given pattern is ECMA regex, given flags will be
  **completely ignored** and taken from given regex.
  
  
  :param string pattern: Pattern of regex.
  :param bool flags: Flags used for the regex matching.
      Allowed flag names are in the `FLAGS` attribute. The flag value
      does not matter as long as it evaluates to True.
      Flags with False values will be ignored.
      Invalid flags will be ignored.
docstr_tok: ["Init",".","Note",",","that","if","given","pattern","is","ECMA","regex",",","given","flags","will","be","*","*","completely","ignored","*","*","and","taken","from","given","regex",".",":","param","string","pattern",":","Pattern","of","regex",".",":","param","bool","flags",":","Flags","used","for","the","regex","matching",".","Allowed","flag","names","are","in","the","`","FLAGS","`","attribute",".","The","flag","value","does","not","matter","as","long","as","it","evaluates","to","True",".","Flags","with","False","values","will","be","ignored",".","Invalid","flags","will","be","ignored","."]
code: def __init__(self, pattern, **flags):
      """Init.
  
      Note, that if given pattern is ECMA regex, given flags will be
      **completely ignored** and taken from given regex.
  
  
      :param string pattern: Pattern of regex.
      :param bool flags: Flags used for the regex matching.
          Allowed flag names are in the `FLAGS` attribute. The flag value
          does not matter as long as it evaluates to True.
          Flags with False values will be ignored.
          Invalid flags will be ignored.
  
      """
      if utilities.is_ecma_regex(pattern):
          result = utilities.convert_ecma_regex_to_python(pattern)
          self.pattern, self.flags = result
      else:
          self.pattern = pattern
          self.flags = [
              self.FLAGS[key]
              for key, value in flags.items()
              if key in self.FLAGS and value
          ]
  
imports: import re
  from six.moves import reduce
  from .errors import ValidationError
  from .None import utilities
label_desc: Use image node_id 1 to create a new Regex object from inherited base classes: object with example: obj = Regex(pattern)