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
Dan 2019-05-07 12:01:30
Source
Share
Answers: 3
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
Grant 2019-05-09 05:57:40
Source
Share
\[start\](.*?)\[end\]
Zhich'll place the message between within a capture.
0
Karl Seguin 2019-05-09 05:05:51
Source
Share
Related questions