Questions tagged [regexp-substr]

Oracle function that extends the functionality of the SUBSTR function by allowing searching a string for a regular expression pattern. See also REGEXP_INSTR, REGEXP_REPLACE, REGEXP_LIKE and REGEXP_COUNT for other functions extended to use regular expressions.

353 questions
1
vote
2 answers

Why is Oracle SQL function regexp_substr not returning all matching characters?

Could anyone (with extensive experience in regular-expression matching) please clarify for me why the following query returns (what I consider) unexpected results in Oracle 12? select regexp_substr('My email: test@tes6t.test',…
Sorin Postelnicu
  • 1,271
  • 1
  • 10
  • 15
1
vote
2 answers

select hyphen seperated column to rows

I have a hyphen separated column containing names. I want to split this column into one single name rows. I am using the following sql : for t_cur in (select id, names str from table where names is not null) loop insert into inv value (select…
Souhail Ouabi
  • 105
  • 3
  • 15
1
vote
1 answer

Redshift REGEXP_SUBSTR get last occurrence of a match

I have a list of page events of all types in a column value ordered by time asc that I got using listagg method. listagg(page,';') within group (order by time) I want to get the occurrence of the last match that matches the…
1
vote
0 answers

regex_substr return just first occurrence MariaDB (Wordpress)

The main idea: get all links from all posts. I trying to select data from WP multisites database by the next command: "select regexp_substr(post_content, '(?<=href=[\'\"])([^\'\"]+)') as link_url from wp_${id}_posts where post_type = 'post' or…
1
vote
1 answer

extract value from json in oracle

For the below possible JSON values in a column, I need to extract value for CAT attribute Input Table | VALUES | -------------------------------------------------------------- |…
Ramesh Kumar
  • 41
  • 1
  • 1
  • 7
1
vote
1 answer

Mysql regexp fails

I'm trying to find any records in table customers where the name does not contain letters. The following is what I am using. When ran, it doesn't return any records found. Would someone point out my mistake, please? table customers { name =…
user3052443
  • 758
  • 1
  • 7
  • 22
1
vote
2 answers

Removing words using RegExp

I have a string with tags. "Hello, world!". And I have to get this string without tags using RegExp. I wrote this code, but I think that it can be easier.…
Mark
  • 13
  • 1
  • 4
1
vote
1 answer

REGEXP_SUBSTR equivalent in HIVE SQL?

Good morning. I am looking for the equivalent in Hive of REGEXP_SUBSTR, which I use in other databases like Teradata. My specific case is: I have a field that has a string. It looks something like this: Row1: ABC ACC ADF AFA BAC CAF Row2: ACC BAC…
lottidah
  • 11
  • 1
  • 3
1
vote
1 answer

Oracle regexp to split numbers and units

I'm trying to extract numbers and units from a input string. I was able to extract the number, but unable extract the units. WITH smpl AS ( SELECT '8.23 ug/dL' str FROM DUAL UNION SELECT 'negative' FROM DUAL UNION SELECT '29.2 ' FROM…
G.Kol
  • 49
  • 5
1
vote
2 answers

Oracle to select all matched occurrences by a regular expression to one column in one row with separator

I know to select all matched occurrences by a regular expression to one column in multiple rows as below: SELECT REGEXP_SUBSTR(str, '\+?\d{3,11}', 1, LEVEL) AS substr FROM ( SELECT 'Txa233141b Ta233141 Ta233142 Ta233147 Ta233148' AS str FROM…
mikezang
  • 2,291
  • 7
  • 32
  • 56
1
vote
1 answer

Split Paragraph Document into Sentences

I had a database of paragraph document. I want to split each sentence in the paragraph on table "master_data" and store it into different table "splittext". master_data table : id | Title | Paragraph splittext table id_sen | sentences | doc_id I…
FH337
  • 69
  • 7
1
vote
1 answer

Validating subexpression in Oracle REGEXP_SUBSTR

Oracle 12cR1 I have a column with lengthy strings like below :Key1:Value1:Key2:Value2:Key3:Value3:Key4...….. The keys are unique numbers. The values are any string value which can even be a number same as any other key. If I give a key i must get…
ArtBajji
  • 949
  • 6
  • 14
1
vote
1 answer

Regexp_substr() function Equivalent for RoomDatabase in Android

I am developing an Android App for some friends to records personal information. I have a mock database with one table "Records". It has three main columns as: _date, hours and mins. I have tested this query and It works perfectly on MySQL Mock…
Orious Glo
  • 11
  • 2
1
vote
3 answers

Trying to Extract Numeric from a text field

I have field with different text entered with a 13 or 17 Digit ID.Need to extract that ID from this field regexp_substr(TXT,'CTRL ACDV\\s+(\\d+)',1,1,'ie').. Txt can can be like this SUPPRESSED AND FORWARDING CTRL{ACDV 36608732875895776 } {DRID…
1
vote
1 answer

How to trim the text in different columns in Oracle

I have a string from database field which contains the data in below format. The UW:,Loading:, CBE: fields can be present. ex1: "[UW:Loading25,CBE] [Loading: 100;120;130] [CBE:150;170;190]" ex2: "[UW: CBE] [CBE:…
Ashutosh
  • 111
  • 14