Using extractregex to remove specific characters

Attempting to use extractregex to remove specific characters from copied text. We utilize a token modifier and would like to remove the "B$_" from a string in the clipboard that would look like "B$_Number". Just can't figure out how to identify the first three characters.

Thanks so much!

"$" has special meaning in regular expressions (it signifies the end of the doc), so you need to escape it by putting a slash before it.

For example:

{sample_data="B$_1234"}

Just the number: {=extractregex(sample_data, "B\$_(.+)")}

If you are certain the number part is really a number, I would use:

Just the number: {=extractregex(sample_data, "B\$_(\d+)")}

"\d" means match a digit, while "." means match any character.

As an aside, for something like this "extractregex" maybe not always be the best solution. It's very powerful but also complex. Text Blaze has a number of simpler methods to manipulate text like "split()" which splits a string into a list based on some delimiter.

For example:

{sample_data="B$_1234"}

Just the number: {=split(sample_data, "_")[2]}

Thank you so much! Works perfectly. That $ was messing me up :blush: