• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

SQL Like ----> Regular Expression

Kntx

Platinum Member
Hey Guys,

I'm looking for a way to translate a pattern for the LIKE keyword in SQL to a regular expression.

To help illustrate what I mean... I imagine a method stub would look something like this.

RegularExpression SqlLikeToRegex(string SqlLikePattern) {
// some code that translates a sql like pattern to a regularexpression
}


The reason being a program I'm rewritting a program that made use of the like keyword in a way that allowed users to create masks to match strings. Over the years all of the users grew to love this and know it well, so I really want to (read... have to) make it work the same.

My problem is the new app uses a disconnected data model, so I can't just perform a LIKE against the database as the disconnected data most likely has a different state than the data on the server. I would like to avoid pushing the data back to the server to perform this operation.

Ideas?? Resources?? Maybe someone has already done this?? Help plz!!
 
SQL Server 2005.

AFAIFK most dbms have regular expression support these days. Not that it helps me one lick!
 
Thanks. I came across that exact same page.

edit: OT, but when translating that code I realized once again how much it chaps that C# doesn't support case fall thru. Had to use a goto!!

edit2: WTG code feature.
 
Back
Top