A
A
Anastasia2021-06-22 02:19:08
PHP
Anastasia, 2021-06-22 02:19:08

How to get all words isolated \n through regex?

Hello. There is a line:

"Какие-то слова:\nСлова которые нужно достать 123\nещё какие-то слова\nещё\nи ещё"
. How can I get only: Words to get 123 ? Anything further is unnecessary.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anastasia, 2021-06-22
@nastya97core

/\\n(.*)\\n/isU

G
Grigory Boev, 2021-06-22
@ProgrammerForever

^.*\n(.*?)\n.*
Example at regex101.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question