Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcards/Regular Expressions in WHERE clause - SIMILAR TO predicate [CORE769] #1151

Closed
firebird-automations opened this issue Sep 17, 2003 · 16 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pcisar

Is related to QA292

SFID: 807985#⁠
Submitted By: pcisar

A RegEx could be compiled and hence run faster against
a table.
----------------------
User: peter_jacobi
Logged In: YES
user_id=845149

Responding to rdifalco comments:

Your query can be formulated in standard SQL as:
... WHERE some_text LIKE 'ttl%=%1';
and will be correctly executed by Firebird.

Generally speaking:

More powerful RegExps are already in FB, see
src/jrd/evl_like.cpp, but not exposed to the SQL
frontend (yet).
----------------------
User: rdifalco
Logged In: YES
user_id=571449

This is a VERY cool thing about MySQL. It allows regular
expression selects on VARCHAR or TEXT BLOB columns. This
is quite powerful and regular expressions are more and
more
becoming the standard for text searching and matching.

For example, I can do:

some_text matches "ttl*.=*.1"

To match "ttl=1", "ttl =1", "ttl= 1", "ttl = 1", etc.
----------------------
User: groovbird
Logged In: YES
user_id=17128

Wildcards are patterns, Regular Expressions are patterns,
but a lot more flexible. I suggest you take a look at the
following documents:

http://sitescooper.org/tao_regexps.html

http://lib.stat.cmu.edu/scgn/v52/section1_7_0_1.html
----------------------
User: helebor
Logged In: YES
user_id=60469

How is this RegEx different to a CONTAINING clause?

select blah,.... from foo
where blahsomething CONTAINING 'blah' ;

Are you talking about wildcards?
----------------------
User: groovbird
Logged In: YES
user_id=17128

A Regular Expression is a way of testing wether a string
matches a certain pattern. Regular Expressions are
commonly known among Unix developers; it exists in the
most popular scripting languages, from Perl to PHP. It
originates from the unix command "grep".

The "like" clause in SQL today has a similar purpose,
allthough the possibilities are extremely limited.

In most implementations, a RegEx can be compiled to be
reused against a number of strings. This way, it would be
nice to have a "like" clause using Regular expressions.
Given the following example:

select * from employees where name matches '^[ab]';

would select all employees whose name starts with either a
or b.

Implementations of Regular Expressions for use in Unix
C/C++ aplications are readily available as a shared
library, but I'm myself not an experienced C developer
so I
wouldn't be able to just "jump in" and do it myself.

====== Test Details ======

See also test for CORE2006

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

issuetype: New Feature [ 2 ] => Improvement [ 4 ]

assignee: Dmitry Yemanov [ dimitr ]

SF_ID: 807985 =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

assignee: Dmitry Yemanov [ dimitr ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Will be done with the SQL standard SIMILAR predicate.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

SF_ID: 807985 =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 2.5 Alpha 1 [ 10224 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Dimitrios Chr. Ioannidis (dchri)

Use of the new Target Final Release Version field.

@firebird-automations
Copy link
Collaborator Author

Modified by: Dimitrios Chr. Ioannidis (dchri)

Target Final Release Version: 2.5.0 [ 10221 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

issuetype: Improvement [ 4 ] => New Feature [ 2 ]

summary: Wildcards/Regular Expressions in WHERE clause => Wildcards/Regular Expressions in WHERE clause - SIMILAR TO predicate

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Implemented SIMILAR TO predicate.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 10793 ] => Firebird [ 15192 ]

@firebird-automations
Copy link
Collaborator Author

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA292 [ QA292 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pmakowski

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test

Test Details: See test for CORE2006

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test => Done successfully

Test Details: See test for CORE2006 => See also test for CORE2006

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants