Escaping the vertical pipe character in script

Greetings to all;

As the topic title implies: how to escape the vertical pipe character "|" during script processing?

As anyone who has ever fiddled with a WSS knows, the pipe character is used as a separator in multiple-field outputs in Mp3Tag. This means having a pipe contained in a string wreaks havoc during processing.

A search in the forum indicates using a backslash to escape the character; but this doesn't seem to work in specific regard to the pipe character, as the parser engine still considers a backslashed-escaped pipe as a valid separator.

I already have a workaround, with the use of the similar "Halfwidth Forms Light Vertical" or $char(65512), but the question remains: is it possible (currently) to escape a pipe character, in a way that it doesn't interfere with normal WSS processing?

As an example of this, consider:

Thank you in advance.

Replace with $verticalBar() doesn’t work?

There's a special command made up for web source scripts called $verticalBar() that's an internal representation of the pipe character | that doesn't create a separation/moves to the next track/interfering with your outputs. When your script gets to Adjust Tags, all instances of $verticalBar() are automatically changed back into | for your output.

The main use has been using the replace command to replace "|" "$verticalBar()" at the very start below [ParserScriptAlbum]=... which should then replace every instance of | found in your source's input, which by then is loaded into Current Position/pointer/Line and Position/whatever to replace those instances.

Any time you want to insert | without creating a separation/moving to the next track, use $verticalBar().

Escape characters can get funky because there's now different syntaxes in Mp3tag web sources, between web source commands using the backslash \ then format strings in UseFormat/SayFormat commands using ' and even regular expressions using \. It all still works though :sweat_smile:

Your workaround works in the same way though.

(Also dangit @AreDigg, you beat me to it with a second to spare :rofl:)

Sorry! :joy: But you have much more comprehensive answer.

Of course you're both correct, as is the documentation (which I forgot to check :blush:):

For fields that have varying contents for tracks, e.g., `TITLE`, `TRACK`, or `ISRC`, Mp3tag expects the output buffer to contain the individual values separated and finalized by the pipe character `|`, e.g., `Title 1|Title 2|Title 3|`. Use `$verticalBar()` in case you need to emit the pipe character as content of a field. 

$verticalBar() doesn't make the most pleasant debug output string to look at, but that is the solution.
@AreDigg as you were first, you get the "Solved" prize.

@arb you had the most complete answer, so you get an emoji prize :trophy:.

And I get to rewrite my script...... again :joy: :melting_face:
Thank you all :+1: