Articles in this section
Category / Section

How to Remove Unwanted Characters from a String in Bold Reports


BoldReports provides a convenient method to remove unwanted characters from a string using the System.Text.RegularExpressions.Regex.Replace function. This functionality allows you to customize the removal of specific characters based on your requirements.
Use the following Expression to remove the Unwanted characters.

=System.Text.RegularExpressions.Regex.Replace(Fields!YourField.Value, “[desiredCharacters]”, “”)

  • Fields!YourField.Value is the expression for the field that contains the string.
  • [desiredCharacters] is a regular expression that matches all characters that are not in the desired character string.
  • “” is the replacement string.

In the following example, remove all characters except numbers from the string.

Expression Output
=System.Text.RegularExpressions.Regex.Replace(“A123456sdfghjxcv1b2-c?~~`!@#$ %^&*()_+{}[]3d4e5f6g”, “[^0-9]”, “”) 123456123456

Find the following sample report.

Was this article useful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied