Skip to content
Advertisement

Tag: regex

How to find and replace string using REGEXP_REPLACE in postgresql

I have a table of email addresses: How can I find and replace the email format so example.person@gmail.com -> example.person_gmailcom@test.com? E.g: Results in example.person@test.comgmail.com Playground here: https://dbfiddle.uk/GnIfomiO Answer This is probably most simply done by splitting the email address in two on the @, keeping the part before it and replacing . in the part after it with nothing. Then

SQL query to get / delimited column value in single row

I have this output: Table 1 Requisition_number per_id per_name Job_title Interview TAS_EMAIL_ADDRESS TAS_FNAME 22021 1097 Chad Manager This is a comment abc.g@gmail.COM abc 22021 1097 Chad Manager This is a comment xyz.g@gmail.COM xyz I want the output to look like this: Requisition_number per_id per_name Job_title Interview TAS_EMAIL_ADDRESS TAS_FNAME 22021 1097 Chad Manager This is a comment abc.g@gmail.COM abc/xyz 22021 1097

SQL – trimming values before bracket

I have a column of values where some values contain brackets with text which I would like to remove. This is an example of what I have and what I want: I have only come across approaches that use the number of characters or the position to trim the string, but these values have varying lengths. One way I was

BigQuery SQL Regex_extract repeated pattern

New to regexp, below is the sample query and our try as below union all select ‘https://www.this-is-pqrs.com/<some_text>/ab.abc.ef.gh.ij/123456.csv’ str union all select ‘https://www.this-is-pqrs.com/<some_text>/ab.abd.ef.gh.ij/123456.csv’ str union all select ‘https://www.this-is-abcd.com/<some_text>/ab.abc.ef.gh.ij/123456.csv’ str ) select REGEXP_EXTRACT(string_tbl.str, r”ab[^/]*”) from string_tbl; output we are getting: Required output: Answer Use below with output

Snowflake Regular Expression

I have this string in Snowflake column: I need to get names in this format regardless of the number of company names: “SpecTra, Signal Capital Partners”. In other words, I need to extract company names and concatenate them. I have tried this : and regexp_substr() function, but did not get the desired output Can you please help me with this?

translate query from Oracle to Postgres

I need to translate this query from Oracle to Postgres: can someone help me? thanks in advance for your attention and support Answer In postgres the operateur ~ performs a regex comparison as thus replaces the Oracle function regexp_like(). Your query therefore becomes. I would like to alert your attention that the test not upper(location) ~ ‘^[0-9]{1,5}.* [a-z]’ will always

SAME SQL regexp_extract, different impala and hive output. Why?

The same SQL command has two different output on Hive and Impala: Hive output: ff Impala output: ffff Why such difference? Please explain difference in terms of each engine’s method of processing and outputting characters space-by-space, from left to right or right to left, step by step, and the reasoning, logic, and engines’ coding. Of course, talking about difference needs

Advertisement