Regex in Sublime Text tmLanguage file does not use multiline

I am trying to create my own syntax language file to highlight and help with the creation of new documents in Sublime Text 2. I came quite far, but I was stuck with the specific problem of finding Regex in the tmLanguage file. I just want to be able to match a regex across multiple lines in a YAML document, which I then convert to PList for use in Sublime Text as a package. This will not work.

This is my regex:

/(foo[^.#]*bar)/

And here is how it looks inside the YAML tmLanguage document:

patterns:
- include: '#test'

repository:
  test:
    comment: Tester pattern
    name: constant.numeric.xdoc
    match: (foo[^.#]*bar)

If I create this YAML in the tmLanguage file and use it as a package in Sublime Text, I create a document that uses this custom syntax, try it and do the following:

This will match:

foo 12345 bar

:

foo
12345
bar

Regex, , tmLanguage .

tmLanguage, , :

match: (/foo[^.#]*bar/gm)
match: /(/foo[^.#]*bar/)/gm
match: /foo[^.#]*bar/gm
match: foo[^.#]*bar

. Regex , tmLanguage Sublime Text 2.

.

EDIT: , begin/end, , , . - , - "foo", "12345" "bar" -, .

+4
1

, . TextMate Manual, Sublime Text .

12.2

<... >

, . , , . : , . / .

, / . .

+2

Source: https://habr.com/ru/post/1606274/


All Articles