Skip to main content
Legend
June 6, 2013
Question

wildcards

  • June 6, 2013
  • 1 reply
  • 910 views

Not a disaster, but I'm wondering whether there's a work-around for a mild inconvenience … when I'm blatting my way through text files with vi I ruthlessly suppress spaces at the end of a line with s/{space}$//

Thoughtfully, vi then deletes the space but leaves the EOL where it was.

The equivalent in FM deletes the space and the EOL, effectively adding an unwanted join function.

Any ideas? I've already tried s/{space}$/{char}/ in case this might support a two-step approach where I then delete all occurrences of {char}. It doesn't :-{

N

This topic has been closed for replies.

1 reply

Arnis Gubins
Inspiring
June 6, 2013

Niels,

Another approach might be to use the SpellChecker. This will also flag and correct extra spaces for you. Using SmartSpaces also helps prevent them in the first place.

IIRC, FM uses a very simple form of regex that is "greedy" and will grab the end of paragraph (\p) character as part of the find. If you want to explicitly search for the space character, use the hexcode \x20. Then do a pass looking for two spaces at the end, e.g. \x20\x20$

That should clean up most lines, but will leave a single space at the end of a paragraph (after any punctuation). If you try to search for the punctuation plus space, FM will still grab the \p, so I think you just have to let it be, as I don't know of any FM wildcard combo that will find just the space after the punctuation at the end of a line without grabbing the end of paragraph character as well.

Legend
June 7, 2013

Thanks for the explanations, Arnis. The real problem is that I forgot to add empty lines between paragraphs when preparing an MML file for import … so the quickest way to deal with {space}EOL will be to make sure it doesn't happen  Pity about the low-grade regex, though.