Sublime Forum

Regex doesn't match

#1

Hello,

I have a weird case and I don’t know if I am doing something bad.

I have a document with newlines.

I tried ^\n, ^\r\n, \r\n\r\n with no match.

If I use an hex editor I can see that there is a 0D0A0D0A that should be \r\n\r\n, right?
But, as you may note, it does not match.

What part am I missing?
I am sorry but I am a new user and since that, I cannot upload more than one image to the topic :frowning:

Thanks in advance

0 Likes

#2

image

0 Likes

#3

Looks like you’re viewing a binary file as hexadecimal? In that case you need to match the hexadecimal itself, eg: ^0D0A0D0A

0 Likes

#4

Hello,

No, the second image is from an hex editor to demonstrate that this is a CRLF. There are two CRLF in the hex editor, one from the previous endline and another for the blank one. But my regex ^\r\n is not matching, what is weird.

Thanks for replying.

0 Likes

#5

Sublime normalizes the line endings to \n when loading so \r will never match

0 Likes

#6

^\n doesn’t match either.

0 Likes

#7

It’s working fine for me:

0 Likes

#8

I have reopened the file and it is working for me now also. I don’t know what happened, but I tried ^\n before and it didn’t worked. Thanks for your help.

0 Likes