Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular expressions in stored procedures

Can a regular expression be used inside a stored procedure? If it can, how? Can you give some examples of how to do it?

like image 484
TestSubject09 Avatar asked Oct 30 '09 14:10

TestSubject09


People also ask

Can you use regular expressions in SQL Server?

Regular expressions are a concise and flexible notation for finding and replacing patterns of text. A specific set of regular expressions can be used in the Find what field of the SQL Server Management Studio Find and Replace dialog box.

Can we use regular expression in PostgreSQL?

The Regular Expressions in PostgreSQL are implemented using the TILDE (~) operator and uses '. *” as a wildcard operator. As you can see in the figure above, we have used Regular Expression in PostgreSQL using the TILDE (~) operator and the wildcard '.

What does '$' mean in regex?

$ means "Match the end of the string" (the position after the last character in the string). Both are called anchors and ensure that the entire string is matched instead of just a substring.


1 Answers

Generally, yes.

MySQL: http://dev.mysql.com/doc/refman/5.1/en/regexp.html

Oracle: http://www.oracle.com/technology/obe/obe10gdb/develop/regexp/regexp.htm

MS SQL: http://msdn.microsoft.com/en-us/magazine/cc163473.aspx

Some more:

PostgreSQL: http://www.postgresql.org/docs/8.3/static/functions-matching.html

DB2: http://www.ibm.com/developerworks/data/library/techarticle/0301stolze/0301stolze.html

Informix: http://www.ibm.com/developerworks/data/zones/informix/library/techarticle/db_regexp.html

SQL Anywhere: http://iablog.sybase.com/paulley/2009/06/using-regular-expressions-with-sql-anywhere/

like image 188
o.k.w Avatar answered Nov 08 '22 13:11

o.k.w