# Regex : To take out a sub-string in between 2 tags in a string

I have a documents in the adhering to layout :

Data Data
Data
[Start]
Data I want
[End]
Data


I would certainly such as to order the Data I want from in between the [Start] and also [End] tags making use of a Regex. Can any person show me just how this could be done?

0
2019-05-07 12:01:30
Source Share

With Perl you can border the information you desire with ()'s and also draw it out later on, probably various other languages have a comparable attribute.

if ($s_output =~ /(data data data data START(data data data)END (data data)/) {$dataAllOfIt = $1; # 1 full string$dataInMiddle = $2; # 2 Middle Data$dataAtEnd = \$3;        # 3 End Data
}

0
2019-05-09 05:57:40
Source
$start$\s*(((?!$start$|$end$).)+)\s*$end$


This need to with any luck go down the [start] and also [end] pens too.

0
2019-05-09 05:15:00
Source
$start$(.*?)$end$


Zhich'll place the message between within a capture.

0
2019-05-09 05:05:51
Source