MurciaNew has asked for the wisdom of the Perl Monks concerning the following question:
i have a regex problem. I want to get the text between two words with colon (like Example: or Epikrise:)
I have files (newLine is "\r\n").
Example of just two files: <<< start file 1>>> Test:\r\n blablabla1\r\n blablablabla2\r\n blablablablabla3\r\n blablablab4\r\n blablablaba5\r\n Test1:\r\n lalala1\r\n lalala2\r\n Hello3:\r\n mymymymy\r\n <<< end file 1>>> <<< start file 2>>> Test:\r\n blablabla1\r\n blablablabla2\r\n blablablablabla3\r\n blablablab4\r\n blablablaba5\r\n blablablaba6\r\n Test3:\r\n lalala1\r\n lalala2\r\n lalala3\r\n City:\r\n Gigi\r\n lulu\r\n Kuku\r\n <<< end file 2>>>
With a regexp I want to get all text between "Test:" to that next line with a string with ":"(colon) (for the examples "Test2:" for file 1 or "Test3:" for file 2
as result Test="blablabla1\r\n blablablabla2\r\n blablablablabla3\r\n blablablab4\r\n blablablaba5\r\n"
or Test="blablabla1\r\n blablablabla2\r\n blablablablabla3\r\n blablablab4\r\n blablablaba5\r\n blablablaba6\r\n" )
I tried (.+?(\r\n.+){1,}?(?!\w+?:)) but it does not work
Please help me..... Thanks
MurciaNew (Guido)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex get Text between two strings with colon
by haukex (Archbishop) on Sep 16, 2017 at 18:44 UTC | |
|
Re: Regex get Text between two strings with colon
by talexb (Chancellor) on Sep 16, 2017 at 19:05 UTC | |
by MurciaNew (Novice) on Sep 16, 2017 at 19:12 UTC | |
by AnomalousMonk (Archbishop) on Sep 16, 2017 at 23:24 UTC | |
by Anonymous Monk on Sep 16, 2017 at 19:49 UTC | |
|
Re: Regex get Text between two strings with colon
by kcott (Archbishop) on Sep 17, 2017 at 05:55 UTC |