Struggeling with Regex
-
Hello everybody, I've been struggeling with a Regex for hours now, and I hope someone of you can help me out of this. I'm trying to capture a "Number" section and a "Text" section from a string like
124[HT][HT]In the year 1560, there was ...[CR][HT][HT]somethingt strange going on.[CR][CR]125[HT][HT]The same pattern followed hour after hour.
I've been trying dozens of different ways in Expresso, but nothing seems to work out.
(?\d+)\t+(?.*(?=\r{2,}))
Mostly I get results having the first number in the proper section, but the complete rest of the string in only one "Text" section. What's my stupid error here? Somehow I'm lost in a maze now. Thank you for your time! Mick
-
Hello everybody, I've been struggeling with a Regex for hours now, and I hope someone of you can help me out of this. I'm trying to capture a "Number" section and a "Text" section from a string like
124[HT][HT]In the year 1560, there was ...[CR][HT][HT]somethingt strange going on.[CR][CR]125[HT][HT]The same pattern followed hour after hour.
I've been trying dozens of different ways in Expresso, but nothing seems to work out.
(?\d+)\t+(?.*(?=\r{2,}))
Mostly I get results having the first number in the proper section, but the complete rest of the string in only one "Text" section. What's my stupid error here? Somehow I'm lost in a maze now. Thank you for your time! Mick
This seems to work for your example input:
(?\d+)\t+(?[^\r\n]+((\r\n|\r|\n)\t+[^\r\n]+)*)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
This seems to work for your example input:
(?\d+)\t+(?[^\r\n]+((\r\n|\r|\n)\t+[^\r\n]+)*)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer