M
MENTAT
Hi,
I am trying to write a regular expression that extracts all the
comment lines between two specified markers in a text. An example
snippet is given below. (comments start with ";")
[MRCP_SERVER] ;MRCP server format:
<Server_IP_Address>:<Server_Port>
; <Server_Port> is 554 for Nuance, 4900 for
Speechworks
; Each server should be specified on a separate
line
;123.123.123.1:554 ; server1
tadlir01:4900 ; comment 1
tadlir02:4900 ; comment 2
[DisableVAD] ; Disables VAD in the TX streamer
I want the output to look like:
[MRCP_SERVER] ;MRCP server format:
<Server_IP_Address>:<Server_Port>
; <Server_Port> is 554 for Nuance, 4900 for
Speechworks
; Each server should be specified on a separate
line
;123.123.123.1:554 ; server1
[DisableVAD] ; Disables VAD in the TX streamer
basically, everything between [MRCP_SERVER] and [DisableVAD] that
starts on a line beginning with ";"
I tried using s/(\[MRCP_SERVER\].*)^[^;].*$(\[DisableVAD\])/marker $1
marker $2/ms. But this doesn't seem to work. What am I doing wrong?
isn't ^[^;].*$ the syntax for everything on a line not beginnign with
";"?
Note also that the input could be of the format
[MRCP_SERVER] ;MRCP server format:
<Server_IP_Address>:<Server_Port>
; <Server_Port> is 554 for Nuance, 4900 for
Speechworks
; Each server should be specified on a separate
line
;123.123.123.1:554 ; server1
tadlir01:4900 ; clk_osr_dev
;some other comment can interrupt, but the next line should be caught
tadlir02:4900 ; clk_osr_test
[DisableVAD] ; Disables VAD in the TX streamer
Any help, in the form of heavily commented regular expressions would
be much appreciated.
I am trying to write a regular expression that extracts all the
comment lines between two specified markers in a text. An example
snippet is given below. (comments start with ";")
[MRCP_SERVER] ;MRCP server format:
<Server_IP_Address>:<Server_Port>
; <Server_Port> is 554 for Nuance, 4900 for
Speechworks
; Each server should be specified on a separate
line
;123.123.123.1:554 ; server1
tadlir01:4900 ; comment 1
tadlir02:4900 ; comment 2
[DisableVAD] ; Disables VAD in the TX streamer
I want the output to look like:
[MRCP_SERVER] ;MRCP server format:
<Server_IP_Address>:<Server_Port>
; <Server_Port> is 554 for Nuance, 4900 for
Speechworks
; Each server should be specified on a separate
line
;123.123.123.1:554 ; server1
[DisableVAD] ; Disables VAD in the TX streamer
basically, everything between [MRCP_SERVER] and [DisableVAD] that
starts on a line beginning with ";"
I tried using s/(\[MRCP_SERVER\].*)^[^;].*$(\[DisableVAD\])/marker $1
marker $2/ms. But this doesn't seem to work. What am I doing wrong?
isn't ^[^;].*$ the syntax for everything on a line not beginnign with
";"?
Note also that the input could be of the format
[MRCP_SERVER] ;MRCP server format:
<Server_IP_Address>:<Server_Port>
; <Server_Port> is 554 for Nuance, 4900 for
Speechworks
; Each server should be specified on a separate
line
;123.123.123.1:554 ; server1
tadlir01:4900 ; clk_osr_dev
;some other comment can interrupt, but the next line should be caught
tadlir02:4900 ; clk_osr_test
[DisableVAD] ; Disables VAD in the TX streamer
Any help, in the form of heavily commented regular expressions would
be much appreciated.