%YAML 1.2 --- name: Regular Expressions (Javascript) scope: source.regexp.js hidden: true contexts: main: - include: anchor - include: backref - include: quantifier - include: operator - include: group-assertion - include: group-definition - include: character-class - include: character-class-definition anchor: - match: '\\[bB]|\^|\$' scope: keyword.control.anchor.regexp backref: - match: '\\[1-9][0-9]*' scope: keyword.other.back-reference.regexp character-class: - match: '\\[wWsSdD]|\.' scope: constant.other.character-class.escape.backslash.regexp - match: '\\([trnvf0\\]|c[A-Z]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|.)' scope: constant.character.escape.backslash.regexp character-class-definition: - match: '(\[)(\^)?' captures: 1: punctuation.definition.character-class.regexp 2: keyword.operator.negation.regexp push: - meta_scope: constant.other.character-class.set.regexp - match: '(\])' captures: 1: punctuation.definition.character-class.regexp pop: true - include: character-class - match: |- (?x) ( (\\[wWsSdD]|\.)| (\\([trnvf0]|c[A-Z]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|.)) )\- ( (\\[wWsSdD]|\.)| (\\([trnvf0]|c[A-Z]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|.)) ) scope: constant.other.character-class.range.regexp captures: 2: constant.other.character-class.escape.backslash.regexp 3: constant.character.escape.backslash.regexp 5: constant.other.character-class.escape.backslash.regexp 6: constant.character.escape.backslash.regexp group-assertion: - match: (\()((\?=)|(\?!)) captures: 1: punctuation.definition.group.regexp 2: punctuation.definition.group.assertion.regexp 3: meta.assertion.look-ahead.regexp 4: meta.assertion.negative-look-ahead.regexp push: - meta_scope: meta.group.assertion.regexp - match: (\)) captures: 1: punctuation.definition.group.regexp pop: true - include: main group-definition: - match: (\()((\?:))? captures: 1: punctuation.definition.group.regexp 3: punctuation.definition.group.no-capture.regexp push: - meta_scope: meta.group.regexp - match: (\)) captures: 1: punctuation.definition.group.regexp pop: true - include: main operator: - match: \| scope: keyword.operator.or.regexp quantifier: - match: '(\?|\*\??|\+\??)|\{(\d+,\d+|\d+,|\d+)\}' scope: keyword.operator.quantifier.regexp