Find and Replace in Source Code - Wildcards

This forum is for all Flare issues not related to any of the other categories.
Post Reply
dcole
Propeller Head
Posts: 25
Joined: Wed Feb 20, 2013 6:54 am

Find and Replace in Source Code - Wildcards

Post by dcole »

In reformatting old manuals from a previous writer, I need to change all tables to be formatted at 100% width instead of a specific width. However, I can't seem to get any wildcards to work in Find and Replace in Files.

For example, I need to replace the following:

width: 666px;

with

width: 100%;

This is part of this string of code:

Code: Select all

<table class="TableStyle-Field_Descriptions" style="caption-side: top;mc-table-style: url('../Resources/TableStyles/Field Descriptions.css');width: 666px;" cellspacing="0">
The issue is that the table widths were not specified previously. The table was dragged to create a width so there are a ton of them with different widths -- Some at 666, some at 669, some at 678, etc, etc.

Anyone have any suggestions on the easiest way to replace thousands of tables at one time instead of one by one?
awells12
Propeller Head
Posts: 70
Joined: Wed Sep 02, 2015 7:51 am

Re: Find and Replace in Source Code - Wildcards

Post by awells12 »

Please let me know if I'm not understanding the problem correctly, but you can apply a specific table style to every table in the project. Create a new table style sheet that has the attributes you want, then click the "Apply Style" button. I haven't tried this personally, but if you select the "Content" folder (all topics) then choose to overwrite existing table styles and remove local formatting, it should apply the style to every table.

Hope this helps.
Image
dcole
Propeller Head
Posts: 25
Joined: Wed Feb 20, 2013 6:54 am

Re: Find and Replace in Source Code - Wildcards

Post by dcole »

Please let me know if I'm not understanding the problem correctly, but you can apply a specific table style to every table in the project.
I do have a table style applied to all tables but is there an option to set the table width to 100% within a table style? If there is, I am not aware of it or am just having a brain lapse.
paintedturtle
Propeller Head
Posts: 88
Joined: Wed May 25, 2016 3:35 pm

Re: Find and Replace in Source Code - Wildcards

Post by paintedturtle »

dcole wrote:I do have a table style applied to all tables but is there an option to set the table width to 100% within a table style? If there is, I am not aware of it or am just having a brain lapse.
When I've accidentally dragged a column in a table to be pixels in width, I think it overrides the % width in an existing table, and I have to right click at the top of the the table/column to Reset Width.

If it's in all your tables:
1. Open up the table style you want to use (mine would be from Content/Resources/Table Styles).
2. Click on "Apply Style..." on the right of the top ribbon of the table style.
3. Select which Content files you want to override the table style of--I'd recommend doing it to a Test folder with a few copied topics in it.
4. Select the "Overwrite existing table styles" and possibly "Remove local formatting" in the boxes at the bottom. (I haven't used the second one.)
5. Click OK.
6. Existing table styles will be overwritten in the selected topics.

Hope that helps!
~Sarah

P.S. This will only help if you have set the columns and table to the % you want within the Table style.
Technical Writer using and experimenting with Flare version 12.0.5991.
GregStenhouse
Sr. Propeller Head
Posts: 330
Joined: Tue May 13, 2008 3:27 pm
Location: Christchurch, New Zealand

Re: Find and Replace in Source Code - Wildcards

Post by GregStenhouse »

If the above doesn't work, the following wildcard search should do it:
Search:

Code: Select all

<table(.*?)width:[ 0-9]+px;(.*?)>
Replace:

Code: Select all

<table\1\2>
Make sure you backup your files before replacing all.
GregStenhouse
Sr. Propeller Head
Posts: 330
Joined: Tue May 13, 2008 3:27 pm
Location: Christchurch, New Zealand

Re: Find and Replace in Source Code - Wildcards

Post by GregStenhouse »

Note the above removes the width, if you want to put a different width in there, replace becomes something like:

Code: Select all

<table\1width:100%;\2>
Post Reply