From: Wayne Brissette Date: 2013-01-04T09:16:27+09:00 Subject: Re: Suggestions on parsing On Jan 3, 2013, at 3:23 PM, Matma Rex wrote: > On Thu, 03 Jan 2013 22:13:14 +0100, Wayne Brissette wrote: > >> >> Normally I would use read in the file, assign it to a variable and then use someVariable.split(" insFld(foldersTree,") >> However, in this case I want everything from the beginning of that line too. Any ideas? Maybe a different way to parse this data? > > For a very simple ugly solution, you could use a regex with lookahead. > > someVariable.split(/(?= insFld\(foldersTree,)/) > > This would essentially split before every occurence (as the match itself would be zero-width; the contents of lookahead expression are not matched, only its "presence"). > > See http://www.regular-expressions.info/lookaround.html for more :) > Close… What this gets me is: insFld(foldersTree, gFld("ntimc0 @0x0.0x0.0x0", "ntimc0_doc.html#addrmap_ntimc0")) addrmap_ntimc0_ntimc_core = insFld(addrmap_ntimc0, gFld("ntimc_core @0x0.0x0.0x0", "ntimc0_doc.html#addrmap_ntimc0_ntimc_core")) reg_ntimc0_ntimc_core_CFG = insDoc(addrmap_ntimc0_ntimc_core, gLnk("R", "CFG @0x0.0x0.0x0", "ntimc0_doc.html#reg_ntimc0_ntimc_core_CFG")) … reg_ntimc0_cfg_node_node_scratch = insDoc(addrmap_ntimc0_cfg_node, gLnk("R", "node_scratch @0x0.0xff.0x20", "ntimc0_doc.html#reg_ntimc0_cfg_node_node_scratch")) addrmap_ntimc1 = What I also need the start of the line (in this case addrmap_ntimc0 = & the addrmap_ntimc1 would belong to the next capture array item.) I struggled with this for a while and couldn't come up with a great solution. I'm hoping somebody here would have an easy fix for me. ;) I'll sleep on this and see what I can come up with tomorrow AM. Thanks Matma! Wayne