I have some text like this:
(This file contains some block of text file, that starts with the line : x/x/x/x
and ends with tgt-noise-margin-down : x
phrase)
------------------------------------------------------------------------------------------------------------------------------------
linkup-record
------------------------------------------------------------------------------------------------------------------------------------
line : 1/1/6/31 link-timestamp-down : 2014-06-16:00:06:11
attained-bitrate-down : 7616 max-bitrate-up : 1024 max-bitrate-down : 4096
threshold-bitrate-up : 512 threshold-bitrate-down : 1024 max-delay-up : 15
max-delay-down : 15 tgt-noise-margin-up : 60 tgt-noise-margin-down : 60
------------------------------------------------------------------------------------------------------------------------------------
linkup-record
------------------------------------------------------------------------------------------------------------------------------------
line : 1/1/6/32 link-timestamp-down : 2014-06-16:00:06:11
attained-bitrate-down : 3616 max-bitrate-up : 512 max-bitrate-down : 2048
threshold-bitrate-up : 256 threshold-bitrate-down : 512 max-delay-up : 15
max-delay-down : 15 tgt-noise-margin-up : 60 tgt-noise-margin-down : 60
------------------------------------------------------------------------------------------------------------------------------------
linkup-record
------------------------------------------------------------------------------------------------------------------------------------
line : 1/1/6/33 link-timestamp-down : 2014-06-16:00:06:11
attained-bitrate-down : 4096 max-bitrate-up : 1024 max-bitrate-down : 4096
threshold-bitrate-up : 1024 threshold-bitrate-down : 1024 max-delay-up : 15
max-delay-down : 15 tgt-noise-margin-up : 100 tgt-noise-margin-down : 80
I want to write a function with the $line
parameter
function extarctText($line)
{
...
return $block;
}
that selects a block that starts with the $line
, for example calling $this->extarctText(1/1/6/32)
should return the this result ($block
) :
line : 1/1/6/32 link-timestamp-down : 2014-06-16:00:06:11
attained-bitrate-down : 3616 max-bitrate-up : 512 max-bitrate-down : 2048
threshold-bitrate-up : 256 threshold-bitrate-down : 512 max-delay-up : 15
max-delay-down : 15 tgt-noise-margin-up : 60 tgt-noise-margin-down : 60