I'm using Sybase 12.5.3, and want/need to do regex pattern matching.
The Sybase help says that regex features have been there since version 11, but I cannot get anything to work.
This document describes the REGEXP and SIMILAR TO search conditions. I have tried both of these with no success, on various tables.
As an example:
SELECT *
FROM REPORTS
WHERE name regexp '开发者_如何学Python.*'
...gives me an error:
Incorrect syntax near 'regexp'.
The only search results for that error are related to MS-SQL.
I've tried various things, including using REGEXP_LIKE and SIMILAR TO, but I get the same sort of error, as if that word is not understood. Am I missing something? The column I'm comparing contains strings.
I can't find any option to enable/disable these features either, and the actual string I'm supplying has no bearing on it.
I'm using DBArtisan 8.7.5 if that's relevant.
Your link goes to a Sybase Anywhere manual but the 12.5.3 you are using? Well that looks like a Sybase ASE version number. Totally different products - I don't think ASE supported Regex till ASE 15. If you are using ASE you'll need to find a different way to do this.
You can use like
instead of a function and provide a regular-expression-like
character class matching - e.g. name like "[0-9]"
See the docs: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc38151.1520/html/iqrefbb/CACGCGGC.htm
It could be regexp('.*')
, but after looking at the Sybase manual for 12.5.x, I don't think that version has a regexp method.
精彩评论