Difference between revisions of "STREXTRACT()"

From Lianjapedia
Jump to: navigation, search
m (Text replace - "Recital" to "Lianja")
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to perform string extraction from between specified delimiters
 
Function to perform string extraction from between specified delimiters
 
  
 
==Syntax==
 
==Syntax==
 
STREXTRACT(<expC1>, <expC2> [,<expC3>[,<expN1>[,<expN2>]]])
 
STREXTRACT(<expC1>, <expC2> [,<expC3>[,<expN1>[,<expN2>]]])
 
  
 
==See Also==
 
==See Also==
 
[[AT()]], [[ATNEXT()]], [[INLIST()]], [[LEFT()]], [[MTOS()]], [[OCCURS()]], [[RAT()]], [[RIGHT()]], [[RPAD()]], [[SET STRESCAPE]], [[STR()]], [[STRTRAN()]], [[STUFF()]], [[SUBSTR()]]
 
[[AT()]], [[ATNEXT()]], [[INLIST()]], [[LEFT()]], [[MTOS()]], [[OCCURS()]], [[RAT()]], [[RIGHT()]], [[RPAD()]], [[SET STRESCAPE]], [[STR()]], [[STRTRAN()]], [[STUFF()]], [[SUBSTR()]]
 
  
 
==Description==
 
==Description==
 
The STREXTRACT() function extracts a string from <expC1> from between the delimiters specified in <expC2> and <expC3>.  The occurrence to be extracted can also be specified.
 
The STREXTRACT() function extracts a string from <expC1> from between the delimiters specified in <expC2> and <expC3>.  The occurrence to be extracted can also be specified.
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
!width="30%"|Parameter||Description
!Parameter||Description
+
 
|-
 
|-
 
|<expC1>||The string to be searched
 
|<expC1>||The string to be searched
 
|-
 
|-
|<expC2>||The start delimiter.  If <expC2> is an empty string, the string is extracted from the start of <expC1> to the first occurrence of <expC3>.
+
|valign="top"|<expC2>||The start delimiter.  If <expC2> is an empty string, the string is extracted from the start of <expC1> to the first occurrence of <expC3>.
 
|-
 
|-
|<expC3>||The end delimiter.  If omitted or empty, the string is extracted from <expC2> to the end of <expC1>
+
|valign="top"|<expC3>||The end delimiter.  If omitted or empty, the string is extracted from <expC2> to the end of <expC1>
 
|-
 
|-
|<expN1>||The occurrence of <expC2> at which to start the extraction.  If omitted, the first occurrence is extracted.
+
|valign="top"|<expN1>||The occurrence of <expC2> at which to start the extraction.  If omitted, the first occurrence is extracted.
 
|-
 
|-
 
|<expN2>||Optional flags (see below).
 
|<expN2>||Optional flags (see below).
 
|-
 
|-
 
|}
 
|}
 
  
 
====Settings:====
 
====Settings:====
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
!width=15%|Bit||Width=15%|Value (additive)||Setting
!Bit||Value (additive)||Setting
+
 
|-
 
|-
 
|0||1||Search is case-insensitive.
 
|0||1||Search is case-insensitive.
 
|-
 
|-
|1||2||End delimiter is not required.  If <expC3> is specified, but not found, the string will be extracted from <expC2> to the end of <expC1>
+
|valign="top"|1||valign="top"|2||End delimiter is not required.  If <expC3> is specified, but not found, the string will be extracted from <expC2> to the end of <expC1>
 
|-
 
|-
|2||4||The delimiters are included in the return string.
+
|valign="top"|2||valign="top"|4||The delimiters are included in the return string.
 
|-
 
|-
 
|}
 
|}
 
 
  
 
==Example==
 
==Example==
Line 60: Line 52:
 
</code>
 
</code>
  
 
==Products==
 
Lianja, Lianja Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:String Data]]
 
 
[[Category:String Data Functions]]
 
[[Category:String Data Functions]]

Latest revision as of 05:32, 10 November 2020

Purpose

Function to perform string extraction from between specified delimiters

Syntax

STREXTRACT(<expC1>, <expC2> [,<expC3>[,<expN1>[,<expN2>]]])

See Also

AT(), ATNEXT(), INLIST(), LEFT(), MTOS(), OCCURS(), RAT(), RIGHT(), RPAD(), SET STRESCAPE, STR(), STRTRAN(), STUFF(), SUBSTR()

Description

The STREXTRACT() function extracts a string from <expC1> from between the delimiters specified in <expC2> and <expC3>. The occurrence to be extracted can also be specified.

Parameter Description
<expC1> The string to be searched
<expC2> The start delimiter. If <expC2> is an empty string, the string is extracted from the start of <expC1> to the first occurrence of <expC3>.
<expC3> The end delimiter. If omitted or empty, the string is extracted from <expC2> to the end of <expC1>
<expN1> The occurrence of <expC2> at which to start the extraction. If omitted, the first occurrence is extracted.
<expN2> Optional flags (see below).

Settings:

Bit Value (additive) Setting
0 1 Search is case-insensitive.
1 2 End delimiter is not required. If <expC3> is specified, but not found, the string will be extracted from <expC2> to the end of <expC1>
2 4 The delimiters are included in the return string.

Example

htmlstring1 = "<title>STREXTRACT()</title>"
? STREXTRACT(htmlstring1, "<title>", "</title>")
STREXTRACT()
 
? STREXTRACT(htmlstring1, "<title>", "</title>",1,4)
<title>STREXTRACT()</title>
 
? STREXTRACT(htmlstring1, "<", ">",2)
/title