Page 1 of 1
Find and Replace, and apply formatting
Posted: Fri Jan 02, 2009 12:35 pm
by jessemds
Fellow madcappers,
Is there anyway to do a Find and Replace and to apply formatting to the words that it finds? For example, I want it to search for the word "Building" and then apply italics to every instance of the word. Preferably it should apply a style, but I will settle for local formatting..
Thanks
Jesse
Re: Find and Replace, and apply formatting
Posted: Fri Jan 02, 2009 12:59 pm
by RamonS
You can do a global find&replace in the source code. Search for "Building" and then have it replaced with the appropriate XHTML formatting tags around it.
Re: Find and Replace, and apply formatting
Posted: Fri Jan 02, 2009 1:21 pm
by KevinDAmery
To add to RamonS's suggestion, here's an example syntax. Again, make sure that Find in Source Code is checked on.
Find:
Building
Replace:
<span class="foundstuff">Building</span>
(the foundstuff class is just an example - use whatever class makes sense given your stylesheet.)
This will add span tags around the found words with the specified class. Then you just need to create a span class or general class that adds the desired formatting and you're off to the races.
Re: Find and Replace, and apply formatting
Posted: Sat Jan 03, 2009 8:25 pm
by SteveS
To add to Kevin's and RamonS's suggestions...
You could do a simple find and replace with <em>building</em> (or <i></i>) but creating a class will give you the flexibility to reformat all the occurences at a later date (if it ever becomes necessary).
Re: Find and Replace, and apply formatting
Posted: Tue Jan 06, 2009 6:31 am
by royj
To add to Ramon's and Kevin's and Steve's excellent information...
Check first to see if any of the current instances of the word you want formatted like this already have formatting applied. You might end up with a span wrapped around another span.
Re: Find and Replace, and apply formatting
Posted: Tue Jan 06, 2009 6:54 am
by jessemds
[/quote]
royj wrote:To add to Ramon's and Kevin's and Steve's excellent information...
Check first to see if any of the current instances of the word you want formatted like this already have formatting applied. You might end up with a span wrapped around another span.
I thought of that. I know for a fact that some of the current instances have the formatting. I guess I am out of luck?
Re: Find and Replace, and apply formatting
Posted: Tue Jan 06, 2009 7:01 am
by royj
jessemds wrote:royj wrote:To add to Ramon's and Kevin's and Steve's excellent information...
Check first to see if any of the current instances of the word you want formatted like this already have formatting applied. You might end up with a span wrapped around another span.
I thought of that. I know for a fact that some of the current instances have the formatting. I guess I am out of luck?
Not necessarily. If all the current instances with formatting are consistent, then you can search for that string in the source, and replace it with the unformatted word. Then go the other way: search for the word and replace it with the formatted word.
For example:
1. If
some of the instances of "Building" have the span class "foundstuff" applied, then search for "<span class="foundstuff">Building</span>" and replace with "Building". This clears the existing formatting that is applied to those instances.
2. Next, search for "Building" and replace with "<span class="foundstuff">Building</span>". Now,
all instances of "Building" will have the span applied.
Re: Find and Replace, and apply formatting
Posted: Wed Jan 14, 2009 7:45 am
by wijnand
I use the tool QuickSR You can give him all the HTML files in one go and tell him what to do when he finds the word so for example:
I have a building
Will become
I have a <i> Building</i>
Be aware though that a search and replace is very dangerous as you have no idea how the syntax is of where the word building is.