Regular expression to match all content between 2 tags

I am trying to capture the following content in PHP using regular expressions:

/ *

Name: Test

Description: my test

* /

I tried the code here: Combine everything between two tags with regular expressions? but it does not capture new lines.

EDIT: I used the following regular file, which works on a single line, but it stops working as soon as it sees a line break

EDIT2: I want to include that I run this script on a large piece of text that has many line breaks. I'm sure we need to use * because I'm not sure about the number of line breaks.

/ * (. *?) * /

TIA

+3
source share
2

. . . /s ( ):

 preg_match("#/[*](.*?)[*]/#s", ...

. , * ( []), /, , . # /

, /ims. ^ $ . , .

+2

s (s dotall)

/*(.*?)*/s

( )

+2

Source: https://habr.com/ru/post/1772023/


All Articles