Hi everyone,
I would like to extract all phrases from a text (e.g., an email body) that match a specific format defined by a regular expression.
Is it possible to achieve this using WEBCON’s built-in functions?
Hi everyone,
I would like to extract all phrases from a text (e.g., an email body) that match a specific format defined by a regular expression.
Is it possible to achieve this using WEBCON’s built-in functions?
Hi Tomasz,
You can try use the SQL command and REGEXP_SUBSTR (SQL Server 2025 required).
In older versions of SQL, you can use PATINDEX e.g:
DECLARE @text NVARCHAR(200) = 'Company details: NIP 1234567890, ul. Testowa 1, Warsaw';
SELECT SUBSTRING(@text, PATINDEX('%[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%', @text), 10) AS NIP;
Regards,
Jacek
Hi Tomasz,
You can try use the SQL command and REGEXP_SUBSTR (SQL Server 2025 required).
In older versions of SQL, you can use PATINDEX e.g:
DECLARE @text NVARCHAR(200) = 'Company details: NIP 1234567890, ul. Testowa 1, Warsaw';
SELECT SUBSTRING(@text, PATINDEX('%[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%', @text), 10) AS NIP;
Regards,
Jacek
Hi Jacek,
Thanks a lot for the suggestion!
I had actually considered something similar earlier (executing a stored procedure). I'm still quite new to WEBCON, so it's good to know it’s one of the commonly used paths.
Tomasz