Uli's Web Site
[ Zathras.de - Uli's Web Site ]
Other Sites: Stories
Abi 2000
Stargate: Resurgence
Lost? Site Map!
     home | blog | moose | programming | articles >> blog

 Blog Topics

15 Most Recent [RSS]

 Less work through Xcode and shell scripts
2011-12-16 @600
 iTunesCantComplain released
2011-10-28 @954
 Dennis Ritchie deceased
2011-10-13 @359
 Thank you, Steve.
2011-10-06 @374
 Cocoa Text System everywhere...
2011-03-27 @788
 Blog migration
2011-01-29 @520
 All you need to know about the Mac keyboard
2010-08-09 @488
 Review: Sherlock
2010-07-31 @978
 Playing with Objective C on Debian
2010-05-08 @456
 Fruit vs. Obst
2010-05-08 @439
 Mixed-language ambiguity
2010-04-15 @994
 Uli's 12:07 AM Law
2010-04-12 @881
 Uli's 1:24 AM Law
2010-04-12 @874
 Uli's 6:28 AM Law
2010-04-12 @869
 Uli's 3:57 PM Law
2010-04-12 @867


Getting more out of Xcode with regular expression search

A neat tidbit that many people overlook is Xcode's Find in Project window, which is the more powerful of Xcode's two search windows. Right next to the "Search" and "Replace" text fields, there are two popup menus that I use the most in this window. The upper popup lets you select where to search. Want to know what's new in Mac OS X 10.4? Choose "Frameworks" here, then search for "MAC_OS_X_VERSION_10_4", and voilà, you can just click to see the APIs in the headers. Get too many irrelevant results for a search term from the system frameworks? Choose "Project" here and see where you are using that term.

But the second field is even more powerful. It lets you select how to search. Usually, you'll want Textual, which is your regular, run-of-the-mill partial string-matching search. Then there's Definitions, which pretty much only searches the implementation files and doesn't bother with function calls or forward declarations. And then there's the Unix-user's favorite swiss army knife: Regular Expression. Regular expressions let you search for complex partial matches.

Want to get rid of those #line 5 "sourcefile.y" directives a code generator littered all over your source to refer back to the original file? But you can't, because the line number is different each time. You could search for "#line" and just select up to the end of the line manually, but why not let the computer do that:
(without the quotes) will match the entire line, starting with "#line" and ending on a newline. Then just replace that with nothing and they're gone. But that's just a simple example. The web is full of regular expression tutorials, and if you know a few basic things, like character classes and greedy and non-greedy repetitions, you can easily save yourself hours.

But if you want to, sure, you can still spend your time manually selecting to the end of each of those 300 lines...

Reader Comments: (RSS Feed)
No comments yet
Or E-Mail Uli privately.

Created: 2006-09-16 @271 Last change: 2006-09-16 @293 | Home | Admin | Edit
© Copyright 2003-2023 by M. Uli Kusterer, all rights reserved.