Sublime Forum

Syntax with regex that matches two lines

#1

I am trying to create a regex to match lines that start with a number of dashes, followed by a line that starts with an asterisk-space, like:

-------------------------------------------
* EXAMPLE

My failed regex, which seems to work on debuggex is:

- match: '^([-]{20,100})\r\n\* '

It should work both on Linux and Windows (I tried \v but apparently is not working).

Any hint?

0 Likes

#2

ST’s syntax engine is line-based. It never across lines with a single regex.

0 Likes

#3

Oooh I see, that’s why. So the solution should be “pushing”, I guess.

Edit: Actually, not. Because I need to see if there is an “*” before applying the format. Is there a way to solve this?

0 Likes

#4

If ------------------------------------------- is important and you are on ST 4, there are branch and fail for that situation. Otherwise, in ST 3, you would have to “guess”.

0 Likes