Sublime Forum

How to find text that contains brackets in it using regex?

#1

Hello ! I’m trying to extract certain lines of text from a list.

Exemple of the list :
Sample (2021) S01E01
Sample (2021) S01E02
Sample (2021) S01E03
Sample (2021) S01E04

I’m trying to extract only “Sample (2021) S01E02,Sample (2021) S01E04” using regex with this command : “Sample (2021) S01E02|Sample (2021) S01E04”

Normaly works if the text doenst cotains brackets in it.

How to match only those lines using regex ?

0 Likes

#2

In regex, ( and ) are special; they denote the parts of the match that should be captured for use in potential later replacements. To use them in the search term, you need to quote them:

Sample \(2021\) S01E02

1 Like

#3

Thanks ! It worked

0 Likes