This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
vba:functions:rxlib [13.10.2016 11:08:02] yaslaw |
vba:functions:rxlib [13.10.2016 11:16:18] yaslaw |
||
---|---|---|---|
Line 69: | Line 69: | ||
===== rxLookup() ===== | ===== rxLookup() ===== | ||
==== Definition ==== | ==== Definition ==== | ||
- | <code>Result = rxLookup(value [,pattern [,iPosition]])</code> | + | <code>Result = rxLookup(value [,pattern [,position]])</code> |
<code vb>Public Function rxLookup( _ | <code vb>Public Function rxLookup( _ | ||
ByVal iValue As Variant, _ | ByVal iValue As Variant, _ | ||
Line 80: | Line 80: | ||
==== Beispiele rxLookup() ==== | ==== Beispiele rxLookup() ==== | ||
- | <code vb>SELECT t.username, rxLookup(t.username, '/(ruedi)/i', -1) AS Ruedi | + | <code sql>SELECT t.username, rxLookup(t.username, '/(ruedi)/i') AS Ruedi |
FROM myTable t | FROM myTable t | ||
WHERE rxMatch(t.username, '/(ruedi)/i'); | WHERE rxMatch(t.username, '/(ruedi)/i'); | ||
Line 88: | Line 88: | ||
Hansruedi | ruedi | Hansruedi | ruedi | ||
Hans-Ruedi | Ruedi | Hans-Ruedi | Ruedi | ||
- | Ruedi | Ruedi</code> | + | Ruedi | Ruedi |
+ | |||
+ | SELECT t.username, | ||
+ | rxLookup(t.username, '/(ns)?([-\s]?)(ruedi)/i', -1) AS fund, | ||
+ | rxLookup(t.username, '/(ns)?([-\s]?)(ruedi)/i', 0) AS treffer_0, | ||
+ | rxLookup(t.username, '/(ns)?([-\s]?)(ruedi)/i', 1) AS treffer_1, | ||
+ | rxLookup(t.username, '/(ns)?([-\s]?)(ruedi)/i', 2) AS treffer_2 | ||
+ | FROM myTable t | ||
+ | WHERE rxMatch(t.username, '/(ns)?([-\s])?(ruedi)/i'); | ||
+ | |||
+ | username | fund | treffer_0 | treffer_1 | treffer_2 | ||
+ | -----------|----------|-----------|-----------|---------- | ||
+ | Hansruedi | nsruedi | ns | | ruedi | ||
+ | Hans-Ruedi | ns-Ruedi | ns | - | Ruedi | ||
+ | Ruedi | Ruedi | | | Ruedi | ||
+ | </code> | ||
===== rxReplace() ===== | ===== rxReplace() ===== | ||
==== Definition ==== | ==== Definition ==== | ||
- | <code>Result = rxReplace(value [,pattern [,iPosition]])</code> | + | <code>Result = rxReplace(value [,pattern [,replace]])</code> |
<code vb>Public Function rxReplace( _ | <code vb>Public Function rxReplace( _ | ||
ByVal iValue As Variant, _ | ByVal iValue As Variant, _ | ||
Line 104: | Line 119: | ||
==== Beispiele rxReplace() ==== | ==== Beispiele rxReplace() ==== | ||
- | <code vb>SELECT t.username, rxReplace(t.username, '/(hans)([-\s]?)ruedi/i', '$1$2Peter') AS Ruedi | + | <code sql>SELECT t.username, rxReplace(t.username, '/(hans)([-\s]?)ruedi/i', '$1$2Peter') AS Ruedi |
FROM myTable t | FROM myTable t | ||
WHERE rxMatch(t.username, '/(ruedi)/i'); | WHERE rxMatch(t.username, '/(ruedi)/i'); |