I have a plain text file something like this:
Ford\tTaurus
F-150
F-250
Toyota\tCamry
Corsica
In other words, a two-level hierarchy where the first child is on the same line as the parent, but subsequent children on lines following, distinguished from being a parent by a two-space prefix (\t
above represents a literal tab in the text).
I need to convert to this using RegEx:
Ford\tTaurus
Ford\tF-150
Ford\tF-250
Toyota\tCamry
Toyota\tCorsica
So, I need to capture the parent (text between \r\n and \t not starting with \s\s), and apply that in the middle of any \r\n\s\s
found until the next parent.
I have a feeling this can be done with some sort of nested groups, but I think I need more caffeine or something, can't seem to work out the pattern.
(Using .NET with IgnoreWhitespace off and Multiline off)