S
S
Shinkiro2022-02-21 15:47:08
Regular Expressions
Shinkiro, 2022-02-21 15:47:08

Notepad++ regex to remove text outside brackets?

there is such a list
custom text [2015]\
custom text [2001] [text] [3 of 3]\
custom text [2007-2008] [text]\
custom text [1997-2001] [text] [4 of 4]\
arbitrary text [2001] [text]\
how to leave only what is in the first square brackets in each line, taking into account that in principle there can be only one of them or after them there can be one or two more pairs of brackets.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twobomb, 2022-02-21
@Shinkiro

Regular expressions without newlines, replace
^[^\[]*\[([^\]]*).*$
with
$1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question