function escapeRegExp(string) {
    return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}

// Callback when a copy button is clicked. Will be passed the node that was clicked
// should then grab the text and replace pieces of text that shouldn't be used in output
function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true) {

    var regexp;
    var match;

    // create regexp to capture prompt and remaining line
    if (isRegexp) {
        regexp = new RegExp('^(' + copybuttonPromptText + ')(.*)')
    } else {
        regexp = new RegExp('^(' + escapeRegExp(copybuttonPromptText) + ')(.*)')
    }

    const outputLines = [];
    var promptFound = false;
    for (const line of textContent.split('\n')) {
        match = line.match(regexp)
        if (match) {
            promptFound = true
            if (removePrompts) {
                outputLines.push(match[2])
            } else {
                outputLines.push(line)
            }
        } else {
            if (!onlyCopyPromptLines) {
            }
        }
    }

    // If no lines with the prompt were found then just use original lines
    if (promptFound) {
        textContent = outputLines.join('\n');
    }

    // Remove a trailing newline to avoid auto-running when pasting
    if (textContent.endsWith("\n")) {
        textContent = textContent.slice(0, -1)
    }
    return textContent
}

.. role:: raw-html(raw)
   :format: html

.. |v| replace:: :raw-html:`<i class="inline-icon fa fa-check" aria-hidden="true"></i>`
.. |x| replace:: :raw-html:`<i class="inline-icon fa fa-times" aria-hidden="true"></i>`

I would like to purchase my own hardware.  What factors do I need to consider?

I want to add an HDD later, in addition to my SSD, what are the performance consequences of doing this?

Can I use an internal SSD with a USB 3 enclosure?  I’ve heard these may have issues?

Can I use an internal SSD with a USB 3 enclosure?  I've heard these may have issues?

Can the IBD (Initial Block Download) be made faster?  Or can wait times be improved?

I’m getting this error: unable to connect to bitcoind: -28: Loading block index… What do I do?

I'm getting this error: unable to connect to bitcoind: -28: Loading block index... What do I do?

What actions, specifically, are only possible with an archival, or ‘unpruned’ node?

The Bitcoin Service is different from the GUI version I am used to using (bitcoin-qt).  How do I use this like I used to?

How does Bitcoin Proxy request (and verify) data when that data is needed by some app using it?

What is the difference between the Bitcoin Wallet Tracker and the Electrum Personal Server?

I want to use my hardware signer, such as Coldcard or Trezor, with my Embassy.  How does this work?

I opened a Lightning channel, but my local balance is lower than I expected.  Where is the remainder?

What would happen if I shut down an Embassy that is running a Lightning node with open channels?

Is it possible to run c-lightning and lnd parallel on the Embassy?

How do I connect my Spark mobile app to the Embassy Spark server?

Are my addresses, channels, and balances all stored in LND or in RTL?

When attempting to add new peer, RTL says “server is still in the process of starting,” but chain state seems to be fully up to date.  What can I do?

When attempting to add new peer, RTL says "server is still in the process of starting," but chain state seems to be fully up to date.  What can I do?

“Server is still in the process of starting,” but LND and RTL are running.  How can I address this?

"Server is still in the process of starting," but LND and RTL are running.  How can I address this?

I get the following error from LND: “Error ECONNREFUSED Fetching Info Failed! Unknown Error.” What’s wrong?

I get the following error from LND: "Error ECONNREFUSED Fetching Info Failed! Unknown Error." What's wrong?

What language does the application I want to package need to be written in?

What considerations go into selecting an application to package?

Can multiple Embassies be setup to run redundantly in physically separate locations?

How does the Embassy compare to other Bitcoin nodes or personal servers?

Would you consider (Umbrel, Nodl, Dojo, etc) a competitor to you guys, or are they different enough to be compatible?

I heard on an old podcast that there will be an Embassy Two, to be launched in 2021.  Is there an ETA on this?

What if someone gets physical access to my device, can they read the contents? Is it encrypted?

I run a business, can I use an Embassy for tasks such as password management and file sharing?

I want to help, but I’m not a developer.  Are there any ways for non-coders to contribute?

I want to help, but I'm not a developer.  Are there any ways for non-coders to contribute?

Can I use my CUPS instance with other people? How does that work?

I get an error (“Unlock Wallet Failed”) when trying to log in to RTL, what can I do?

I get an error ("Unlock Wallet Failed") when trying to log in to RTL, what can I do?

What is happening if I cannot connect with another user on Mastodon?

Can the browser extension be used with Bitwarden hosted on the embassy?

I want to use BTCPayServer on my website, but Tor is the only option, how can visitors access my BTCPay on clearnet?

I’m having issues connecting to users or rooms in Matrix/Synapse, what can I do?

I'm having issues connecting to users or rooms in Matrix/Synapse, what can I do?

My Element desktop client stopped working after an OS update, what is happening?

I don’t see an answer to my question regarding a certain service.  Is there more documentation?

I don't see an answer to my question regarding a certain service.  Is there more documentation?

I want to understand in depth how a Service works and it’s available configuration options.  Where can I go to learn more?

I want to understand in depth how a Service works and it's available configuration options.  Where can I go to learn more?

Do I need to take any additional security precautions with my device, for example with my router/modem?

What if I have an unique network issue, for example, with a firewall?

Can I use the Embassy from behind a VPN, for example, if my router has a built-in VPN?

I’m getting this error: The shell command “apt-get update” returned a failure exit code: 100.  What do I do?

I'm getting this error: The shell command "apt-get update" returned a failure exit code: 100.  What do I do?

Is it true that iOS has some limited functionality in regard to the Embassy?

I’m having trouble using Firefox for Tor addresses on Lineage, what can I do?

I'm having trouble using Firefox for Tor addresses on Lineage, what can I do?

Can I move my Embassy to another location?  What happens when I do this?

What’s the advantage of using the .local address over the .onion address?

What can I do if I am having issues connecting to an Android app?

If I uninstall a service, then re-install it, does any data remain?

Do I need to delete existing backups before doing a new backup? Or does a new backup override the old backup?