Page 1 of 1

Quick way to find characters abutting variables?

Posted: Tue Jun 22, 2010 9:09 am
by Phlawm53
Flare 6 evidently provides no straightforward way to quickly locate or search for text characters that abut a variable without an intervening space.

Does anyone know a reliable and SAFE way to use Find-Replace (or any other tool) to search for these instances and fix them? The key point that occasionally I mistype the text so that the text runs into the variable text. When the project is generated, the variable contents and the ensuing text have no intervening space.

This is driving me crazy -- it's forcing me to generate a project as a Word target, then use Word's spell-checker to find typos of the form [A Flare Variable]some topic text, locate the instances in the Flare project, then change them to [A Flare Variable] some topic text. That is, to locate and correct the missing space between the variable and the text.

Cheers & thanks,
Riley

(P.S. Note that above I emphasized a SAFE way to correct these occurrences. I mention this because trying to use Find-Replace to search for instances of two consecutive space characters and replace them with a single space character will delete ALL instances of " [Flare Variable] ". Ouch!)

Re: Quick way to find characters abutting variables?

Posted: Tue Jun 22, 2010 9:42 am
by Andrew
The only way I know you might be able to do it is with regular expressions, which I don't know how to use. There are a lot of online resources explaining how to use regex.

Re: Quick way to find characters abutting variables?

Posted: Tue Jun 22, 2010 5:19 pm
by Nita Beck
I'm partial to FAR HTML. It's a third-party tool, actually a .chm authoring tool, and it's not very expensive. (It has a per-user license, not a per-machine license so I've got it on all my machines.) I use is solely for its Search-and-Replace functionaliIty. I can build very simple or very complicated search-and-replace rules, including wildcards, to run against my Flare files. Better yet, I can save the search-and-replace routine for easy reuse, which can't be done at all with Flare's Find-and-Replace utility. And even better than that, I can even copy that saved routine to use on a different machine (with FAR HTML installed) or send to my subscontractors (who have FAR HTML).

Re: Quick way to find characters abutting variables?

Posted: Wed Jun 23, 2010 7:08 am
by Phlawm53
Nita:

Thanks -- you planted a seed. I hadn't thought of using a third-party program to parse the contents of the files.

But now that I have, I realize that the jEdit text editor I use for other tasks (http://www.jedit.org/) has extensive search-replace capabilities, including Regex plugins and other utilities; and can operate on entire directories of files. So I might solve my current problem by using jEdit to wade through the HTML looking for instances of variables adjoining non-space characters…

Cheers & thanks 'gain,
Riley

Re: Quick way to find characters abutting variables?

Posted: Wed Jun 30, 2010 8:31 am
by Ken Billing
Try this regular expression:

Name" />[^ <),&.\r\\]

Where Name is the last word of the variable name(s) that you want to find. In my case, all the variables end with the word Name, which makes it easier. But you could also replace it with a matching expression as well.

This particular expression excludes the variable tag followed by spaces, returns, and the characters <),&\ all of which are acceptable in my case.

Hope that helps,
Ken

Re: Quick way to find characters abutting variables?

Posted: Thu Jul 01, 2010 1:38 pm
by Phlawm53
Ken: Thanks for that! Cheers, Riley

Re: Quick way to find characters abutting variables?

Posted: Wed Dec 11, 2013 8:14 am
by gfevrier
Ken, thank you so much for the regular expression: Name" />[^ <),&.\r\\]
For some reason, there are hundreds of instances in our Flare project where there are missing spaces before and after a variable.
I downloaded the free version of Agent Ransack and followed these steps and it worked! We have a dozen variables, though, and you have to run a separate search for each variable name, but it does work.
1. In Agent Ransack on the Main tab, in the Containing text field, enter the regular expression , substituting Name with the Flare variable name.
2. In the Look in field, enter the path of the Flare project.
3. On the Options tab, in the Contents section, select the Regular Expression check box.
4. Click the Start button.
5. The files containing the problem appear in the left pane. Select a file and the line number and text appear in the right pane.

In my case, the problems are in the htm files. The problem variable and text is highlighted in blue.
So you just have to correct the individual files in Flare.

Re: Quick way to find characters abutting variables?

Posted: Wed Dec 11, 2013 9:26 am
by Ken Billing
Glad it helped you. Even still in version 9, Flare has challenges playing nice with variables and spaces. For example, try dragging and copying two variables separated by a space to another place in the text. Flare doesn't copy the second variable (come on, guys!). Copy and paste is more reliable.

Agent Ransack sounds good, but if you'd like to both find and fix problems in your files in one action across many files without opening every one in Flare, check out http://www.digitalvolcano.co.uk/textcrawler.html. It is far and away my favorite tool to use with Flare and has saved me many hours of editing and grief both fixing problems like this one and making wholesale changes across Flare projects. It eliminates the excuse of "It would be a LOT of work."

Re: Quick way to find characters abutting variables?

Posted: Wed Dec 11, 2013 2:33 pm
by Msquared
The most likely reason why there are dozens of places where you have no space before or after a variable and you didn't spot it is because Flare doesn't flag such instances as spelling errors. If it did, you'd notice them as you typed the text.

I'm getting better at remembering to check each time I insert a variable. But it doesn't come naturally to me as part of my editing workflow and I still pick up far too many instances of this when I proof-read my content. :-(

I raised this as a bug. MadCap decided it was a feature request, so if it matters to you, support me and raise a feature request too.

Re: Quick way to find characters abutting variables?

Posted: Sun Dec 15, 2013 4:25 pm
by Phlawm53
Msquared wrote:The most likely reason why there are dozens of places where you have no space before or after a variable and you didn't spot it is because Flare doesn't flag such instances as spelling errors. If it did, you'd notice them as you typed the text.
…
I raised this as a bug. MadCap decided it was a feature request, so if it matters to you, support me and raise a feature request too.
I filed this as a bug / feature request back in version 6. And have raised related issues regarding the clumsiness of Flare's spell checker when it comes to handling Flare's own variable constructions.

My most recent Enhancement request, submitted earlier this year (2013), is for a specialized Preview window that would circumvent Flare's dysfunctional in-topics spell checker with spell checking on a gen'ed-as-Preview topic file. No idea where that suggestion has gone to…

Long story short, as of Flare 9 the only truly reliable way I've found to spell check a Flare project is to gen a Word Target and use Word's spell checker. More than a little inefficient; more than a little annoying…

Cheers & Merry / Happy and all that,
Riley
SFO

Re: Quick way to find characters abutting variables?

Posted: Mon Dec 16, 2013 12:00 am
by Psider
I'd like to chime in and say that I have seen numerous instances where a space appears after a tag (variable, bold, etc) in the editor, but then does not have a space in the output. I keep meaning to send an example to Madcap, but haven't quite got to it yet. And I haven't figured out what causes it. :S
Amber