The app I’m working is a Bible in progress. The SFM files have lines marked with a “\status…” with other lines marked by “\product…”. These are showing up in the chapters after the build is done. Is there a way to use the Changes tab to hide or remove these lines before the build?
I’ve tried Find: “\status” > Replace: " " (basically left blank). I could use a text editor to open all the SFM files and remove these before adding them to the build but was hoping to avoid that with the Changes tab input.
If those SFM lines have content in them (which I assume is the case, otherwise they wouldn’t be very useful…), then the change rule needs to remove that content as well. Here’s a change rule I use to remove any \imte1 and \imte2 lines:
Note the “.+” to capture all of the content of those SFMs. And the replacement is completely empty.
The end of line might be a little tricky, but the “\n” seems to work in my case. If it doesn’t work for you, you can try “\r\n”, or just remove the end of line altogether. Since SAB uses HTML to present the text, extra whitespace should just be absorbed. (Which is also why if you replace with a space, rather than an empty string, you’ll probably get the same result.)
Thanks for that suggestion. I found a great site for testing these and other RegEx expressions (https://regex101.com/). When I entered your suggestions and a few different modifiers, I was not able to get it.
Chris H. sent me a Skype message suggesting I try - ^\status.$ - and that worked in the regex101 but not in SAB. I’m not a coder but the regex101 site explains it and shows the results so I know it matched the find parameter perfectly, but leaving the replace blank did not change anything. I also tried ^\status.$ and \status.$ but nothing removes or hide the lines. I’m open to other ideas.
In the meantime I’ve opened the books in a text editor and added a \rem before each line. That seems to have worked. I tried - Find: \status.$ >> Replace: \rem \status.$ - in the SAB Changes tab and it didn’t work there either.
I’m on a Mac and wonder if anyone had suggestions for a replacement for Notepad++ (Windows only) for Mac. I am familiar with Atom Editor and Brackets, but haven’t found anything as good as Notepad++.
Make sure you get a double backslash in there to represent a single backslash. I would think you want to find:
This means find at the start of the line this exact string "\status ", followed by one or more of any character, followed by an end of line character.
The line endings on Mac may be different, so you can also try at the end “\r” or “\r\n” or just try removing the “\n”. Without the “\n”, it should remove all of the characters up to the end of line. And as I mentioned above, having leftover spaces probably won’t hurt anything.
If it still doesn’t work, try it without the “^”. The "\status " string should only be found at the beginning of a line anyway, so that shouldn’t make any difference.
I can make a text editor suggestion – a couple weeks ago I was needing to use some RegEx syntax which was not understood by RegExPal, Notepad++ or a number of other editors I tried. Eventually I found EditPad Lite 8 which could understand it. As a bonus, it integrates with the excellent RegexBuddy software for building/testing expressions. The one thing Notepad++ had that EditPad Lite is lacking is syntax highlighting for USFM. (or has anyone made this?)
I’m on Mac too, and I didn’t find any text editor which could handle my RegEx.
Are you talking about creating a rule for the Changes tab? Because I don’t understand your end result. The Changes tab expressions use RegEx’s, so if you search for “\status” you will find any space character (that’s what “\s” means) followed by “tatus”. I’m pretty sure that’s not what you want…
We used double backslash to escape the backslash in the tag.
It did leave the carriage return in the processed file. I hope this is not a problem. He could add \n to the search to remove the carriage returns (I tested this on Mac, Windows, and Linux and \n works on all).
Also, I showed Dan the “Show After Changes” button on the source page. It gives you a preview of what will be the result of processing the changes. It includes the changes at the top level and the book collection level.