[TxMt] search and replace

jeff newman bangersandmash at gmail.com
Mon Feb 12 00:38:32 UTC 2007


Hello everyone,

I'm new to many things here -- textmate, regular expressions, etc,  
etc. so I hope this isn't too far off topic for this list (apologies  
in advance if it is). I'm trying to figure out how to do something  
using find/replace.  I have a long bibliography that was sent to me  
as a single line of text.  I'm trying to find a quick and elegant way  
to insert line breaks between each of the individual citations.

Here is an example of the text I'm working with:

> Baddeley, A. "Working Memory." Science. 255: 556-559,1992. Baecker,  
> R. J. Grudin, W. Buxton, et al. Readings in Human-Computer  
> Interaction: Toward the Year 2000. USA: Morgan Kaufinann  
> Publishers, Inc. 1995. Bevirt, B. "Designing Hypertext Navigation  
> Tools.'' Digital Information Group, National Center for Atmospheric  
> Research web site: < http://www. schlucar/dig/bra.inb/design/ 
> navtool.D.html>. 1996. Chandler, P. and J. Sweller. ''Cognitive  
> Load Theory and the Format of Instruction." Cognition and  
> Instruction. 8: 293-332, 1991. Chandler, P. and J. Sweller. 'The  
> Split Attention Effect as a Factor in the Design of Instruction."  
> British Journal of Education Psychology. 62: 233-246, 1992.

I'm just figuring out how to use regular expressions (sorry, not a  
programmer) and I've been able to successfully select the endpoint of  
each of the citations using:

\d{4}\.\s

My problem comes about when I try to replace the space represented by  
\s with a carriage return.  I'm not sure how to structure this in the  
find/replace dialogue.  Is anyone willing to point me in the right  
direction here?  I'm hoping to end up with something that looks like:

> Baddeley, A. "Working Memory." Science. 255: 556-559,1992. Baecker,  
> R. J. Grudin, W. Buxton, et al. Readings in Human-Computer  
> Interaction: Toward the Year 2000. USA: Morgan Kaufinann  
> Publishers, Inc. 1995.
>
> Bevirt, B. "Designing Hypertext Navigation Tools.'' Digital  
> Information Group, National Center for Atmospheric Research web  
> site: < http://www. schlucar/dig/bra.inb/design/navtool.D.html>. 1996.
>
> Chandler, P. and J. Sweller. ''Cognitive Load Theory and the Format  
> of Instruction." Cognition and Instruction. 8: 293-332, 1991.  
> Chandler, P. and J. Sweller. 'The Split Attention Effect as a  
> Factor in the Design of Instruction." British Journal of Education  
> Psychology. 62: 233-246, 1992.

Thank you for any help you can offer.

-- 
j.






More information about the textmate mailing list