I’ve covered in the past some of Flare’s wonky behavior when it comes it to white space. I found another fun trick involving white space while searching in Flare 2.5 yesterday.
One of the changes I needed to make on a document I was working on involved a global search and replace. I needed to change all instances of SnazzyGood API (names changed to protect the innocent) to Snazzy Good API Manual. Easy enough. However, I found when I was done that Flare’s search and replace had missed a number of instances. I took a look at the source of those instances to find out why.
It turns out that in the HTML, Flare occasionally inserted a line break and extra white space between SnazzyGood and API, instead of just a single space. Since HTML treats any length of white space as a single space, this:
<p>I like to use the SnazzyGood API</p>
has the same output as this:
<p>I like to use the SnazzyGood API</p>
But Flare treats them as different strings in searches, which is not the behavior I would expect. This means that you can’t trust any search with a space in it. Oh, Flare, why won’t you let me love you more?
Fortunately, Flare has the option to use regular expressions in searches, so we can work around this feature.
First, in the Find and Replace window, you need to tell Flare that your search will use regular expressions. Under options, select Use and then choose Regular Expressions from the drop-down.
Now, under Find what, you’ll need to replace any spaces with s+. s means any white space. + means one or more occurrence. So my search and replace becomes:
Not sure if the fine folks in San Diego have fixed this for version 3.0 or if they actually think this is a good idea, but in 2.5, you’ll need to use this any time you want to use Flare’s search and replace to find a string containing spaces.
1 reply on “White Space in Flare Searches”
So I guess you mean “feature” as in “it’s not a bug, it’s a feature”…?