Skip to content

Commit

Permalink
Fix error in substring-similar syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mrotteveel committed Apr 5, 2021
1 parent 2e24d9d commit 4aa7753
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Expand Up @@ -10,6 +10,11 @@ The exact file history is recorded in our _git_ repository; see https://github.c
|===
4+|Revision History

|1.1
|05 Apr 2021
|MR
a|Corrected syntax mistake in `SUBSTRING(... SIMILAR ...)` documentation.

|1.0
|20 Feb 2021
|MR
Expand Down
Expand Up @@ -2171,7 +2171,7 @@ SUBSTRING ( <substring-args> )
<substring-args> ::=
_str_ FROM _startpos_ [FOR _length_]
| _str_ [NOT] SIMILAR TO <similar-pattern> ESCAPE <escape>
| _str_ SIMILAR <similar-pattern> ESCAPE <escape>
<similar-pattern> ::=
<similar-pattern-R1>
Expand Down Expand Up @@ -2236,10 +2236,10 @@ insert into AbbrNames(AbbrName)
[[fblangref30-scalarfuncs-substring-regexp]]
==== Regular Expression `SUBSTRING`

In the regular expression form (with `SIMILAR TO`), the `SUBSTRING` function returns part of the string matching an SQL regular expression pattern.
In the regular expression form (with `SIMILAR`), the `SUBSTRING` function returns part of the string matching an SQL regular expression pattern.
If no match is found, `NULL` is returned.

The `SIMILAR TO` pattern is formed from three SQL regular expression patterns, _R1_, _R2_ and _R3_.
The `SIMILAR` pattern is formed from three SQL regular expression patterns, _R1_, _R2_ and _R3_.
The entire pattern takes the form of `R1 || '__<escape>__"' || R2 || '__<escape>__"' || R3`, where _<escape>_ is the escape character defined in the `ESCAPE` clause.
_R2_ is the pattern that matches the substring to extract, and is enclosed between escaped double quotes (`__<escape>__"`, e.g. "```++#"++```" with escape character '```++#++```').
_R1_ matches the prefix of the string, and _R3_ the suffix of the string.
Expand Down
@@ -1,7 +1,7 @@
[[fblangref30]]
= Firebird 3.0 Language Reference
Dmitry Filippov; Alexander Karpeykin; Alexey Kovyazin; Dmitry Kuzmenko; Denis Simonov; Paul Vinkenoog; Dmitry Yemanov; Mark Rotteveel
1.0, 20 February 2021
1.1, 5 April 2021
:doctype: book
:sectnums:
:sectanchors:
Expand Down
4 changes: 2 additions & 2 deletions src/docs/asciidoc/en/rlsnotes/rlsnotes30/_dml-30.adoc
Expand Up @@ -417,12 +417,12 @@ A substring search can now use a regular expression.
.Search Pattern
[listing]
----
SUBSTRING(<string> [NOT] SIMILAR TO <pattern> ESCAPE <char>)
SUBSTRING(<string> SIMILAR <pattern> ESCAPE <char>)
----

Discussion: Tracker http://tracker.firebirdsql.org/browse/CORE-2006[CORE-2006]

For more information about the use of `SIMILAR TO` expressions, refer to `README.similar_to.txt` in the /doc/ subdirectory of your Firebird installation.
For more information about the use of `SIMILAR` expressions, refer to `README.similar_to.txt` in the /doc/ subdirectory of your Firebird installation.

[TIP]
====
Expand Down

0 comments on commit 4aa7753

Please sign in to comment.