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
Find and Replace, and apply formatting
-
RamonS
- Senior Propellus Maximus
- Posts: 4293
- Joined: Thu Feb 02, 2006 9:29 am
- Location: The Electric City
Re: Find and Replace, and apply formatting
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.
New Book: Creating user-friendly Online Help
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U

Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
-
KevinDAmery
- Propellus Maximus
- Posts: 1985
- Joined: Tue Jan 23, 2007 8:18 am
- Location: Darn, I knew I was around here somewhere...
Re: Find and Replace, and apply formatting
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.
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.
Until next time....

Kevin Amery
Certified MAD for Flare
Kevin Amery
Certified MAD for Flare
-
SteveS
- Senior Propellus Maximus
- Posts: 2090
- Joined: Tue Mar 07, 2006 5:06 pm
- Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
- Contact:
Re: Find and Replace, and apply formatting
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).
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).
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Re: Find and Replace, and apply formatting
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.
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.
Roy Jacobsen
Writing, Clear and Simple
Fargo, ND
royj@writingclearandsimple.com
http://rmjacobsen.squarespace.com
Writing, Clear and Simple
Fargo, ND
royj@writingclearandsimple.com
http://rmjacobsen.squarespace.com
Re: Find and Replace, and apply formatting
[/quote]
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?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.
Re: Find and Replace, and apply formatting
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.jessemds wrote: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?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.
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.
Roy Jacobsen
Writing, Clear and Simple
Fargo, ND
royj@writingclearandsimple.com
http://rmjacobsen.squarespace.com
Writing, Clear and Simple
Fargo, ND
royj@writingclearandsimple.com
http://rmjacobsen.squarespace.com
Re: Find and Replace, and apply formatting
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.
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.