I’m writing a report using SQL Server BIDS (Business Intelligence Development Studio, VS2008), and I have the requirement to remove punctuation from field values.
For example, if the field value is “Hello, World!”, I want the report to show the value as “Hello World”. I’m aware in this example it’d be easy enough to use the Replace function, nested:
=Replace(Replace(Fields!Description.Value,",",""),"!","")
But this quickly becomes ‘ugly’ if I have to remove more than just “,” and “!” characters. So, in short:
Can I use Regular Expressions to format field values in a SQL Server BIDS report?
If the answer is “no”, that’s fine, it’ll save me wasting time trying to find it! Thanks.
UPDATE
Usage of Regex in expression formula (though this one is for phone numbers):
=System.Text.RegularExpressions.Regex.Replace(Fields!Phone.Value, "(\d{3})[ -.]*(\d{3})[ -.]*(\d{4})", "($1) $2-$3")
To process large set of rows on client side may take some time. So i propose to move Regex logic on Server side.
You can use CLR function for this.
Look for examples here: http://www.simple-talk.com/sql/t-sql-programming/clr-assembly-regex-functions-for-sql-server-by-example/
Update
If you want to process on client side, let you look at using expressions (include regex) in reports:
http://msdn.microsoft.com/en-us/library/ms157328(v=SQL.100).aspx