Use Regular Expressions
In the following locations, you can use Regular Expressions to exclude tables named in a specific way:
- Names of tables to ignore (case insensitive regular expressions) in the Built-in parameters node
- Properties dialog when working in Free definition:
The following is an explanation of the Regular Expression system used by the CAST Transaction Configuration Center and some examples of how to use it.
System in use
The CAST Transaction Configuration Center uses the Java Regular Expression system - you can find out more about this here: https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
|String searched||Regular expression to enter|
|Strings containing "src"||src|
|Strings exactly matching "src"||^src$|
|Strings starting with "src"||^src|
|Strings ending with "src"||src$|
|A string exactly matching "src"||/src$|
|A string exactly matching ".src"||/\.src$|
|One or more upper case letters, but not zero||[A-Z]+|
|Any sequence of characters or any length - i.e. match all tables||.*|
Number of characters
You can enter a Regular Expression of up to 500 characters.
Please note that by default the CAST Transaction Configuration Center matches only part of the string corresponding to the Regular Expression you have entered, rather than the entire string. As such to match an entire string please use the ^ and $ characters around the required string.
Please note that the following characters are "reserved characters" and therefore must be "escaped" with a backslash before being used in a Regular Expression:
. ( ) [ ] ^ $
So, for example to match for an item (a folder in this case) entitled ComplexityVolume(PercentageofLOC), you will need to enter ^ComplexityVolume\(PercentageofLOC\) in the Regular expression field.
Please see the section entitled "Backslashes, escapes, and quoting" in https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information.
Using Regular Expressions when your CAST databases are hosted on a Microsoft SQL Server
If your CAST databases are hosted on a Microsoft SQL Server, the Regular Expression features will not function in an "out of the box" setup. To enable the feature you need to do the following:
- First determine whether the Microsoft SQL Server hosting the CAST databases is 32bit or 64bit
- Then browse to the installation location of the CAST Transaction Configuration Center - by default this is set to:
- Browse to the following location within the above folder:
- Within this folder, there are two subfolders (one for a 32bit Microsoft SQL Server and one for a 64bit Microsoft SQL Server) containing an identically named file CAST.DotNet.SearchPattern.dll - copy the appropriate file to the following location on the machine hosting your Microsoft SQL Server:
- 32bit Microsoft SQL Server on a 64bit host: %PROGRAMFILES(x86)%\Microsoft SQL Server\MSSQL10.<INSTANCE_NAME>\MSSQL\Binn
- 64bit Microsoft SQL Server on a 64bit host and 32bit Microsoft SQL Server on 32 bit host: %PROGRAMFILES%\Microsoft SQL Server\MSSQL10.<INSTANCE_NAME>\MSSQL\Binn
- Now execute the following script on the Windows machine hosting the Microsoft SQL Server using SQL Server Management Studio or a similar IDE. Please ensure you update the path to the CAST.DotNet.SearchPattern.dll file referenced in the script - this must match the location on the Windows host:
sp_configure 'show advanced options', 1 go RECONFIGURE go sp_configure 'clr enabled' , 1 go RECONFIGURE go CREATE ASSEMBLY SearchPattern from 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\CAST.DotNet.SearchPattern.dll' go CREATE FUNCTION dbo.REGEXP_LIKE ( @subject nvarchar(4000), @pattern nvarchar(4000), @option nvarchar(255) ) RETURNS int AS external name SearchPattern.SearchPattern.SearchRegexPattern go
Once the above steps are complete, you should now be able to use the Regular Expression features when working with a Microsoft SQL Server.