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
Tag: regexp-replace
regex to find “null” values from a column
I have a column JSON_DATA. The values within this column have an object type. It contains a json. This query works fine: This is how the data might look like: Some of the values within this field are “null”. I want to search all occurrences of quoted “nulls” and replace/regex_replace them with proper NULL values. Desired output result: I tried
Hive regexp_extract numeric value from a string
I have a table as: I am trying to get the numeric values from the table. The expected output is A -> 123 / B -> 124 etc I am trying to do using regexp_extract Any suggestions please? Answer If the delimiters are fixed – ‘; ‘ between key-value pairs and ‘=’ between key and value, you can use str_to_map
REGEXP_REPLACE Strings Starting and Ending with Specific Substrings in Snowflake
I am trying to create a column in a view in Snowflake that replaces any string between strings that I care about with nothing. This is essentially for the purpose of stripping html formatting out of text. As an example: Would should end up like this: Based on the patterns I am seeing, I think that if I can eliminate
Oracle SQL REGEXP to fetch the last numeric value in a string
I have the below string value in a column and I need to extract the last numeric value. I have used SUBSTR(ColumnA, -1, 1), but this is extracting only the last digit. ColumnA 12_23_AB245-F5 66_78_HJ378-G5567 55_16_GC761-B99898 Below is the expected result ColumnA 5 5567 99898 Answer Use REGEXP_SUBSTR here with the pattern [0-9]+$: Demo
How to select values between a XML tag in SQL Query
I have a table with CLOB column storing a XML. The structure of XML is unreadable. I want to get values between few tags like <DOMAINID>; sample is shown below. XML: I am using this: Expected result: Actual XML: Answer Do not use regular expressions to parse XML; use a proper XML parser. However, what you have is not properly
Unable to unnest in bigquery when there is comma inside list which is of type string
Unable to unnest in bigquery when there is comma inside list which is of type string. I have data in following format where value is type of string When I use following query, It is incorrectly splitting and unable to get logic right in regexp_replace With the above code, I am getting My expected output is I have followed following
capture the starting characters with many patterns
I need to capture the starting characters from database objects with various pattern search. I have tried using the REGEX expression ,below query i am trying and the expected data set to be. Query 1 …
How to remove one or more instances of ‘?*’ in a string using REGEXP_REPLACE function in oracle?
I’m getting the characters ‘?*’ one to three times in a column called Line. I am required to remove these characters. How do I do it using Replace or REGEXP_REPLACE? SELECT Line, REGEXP_REPLACE(…
Enquote multiple text fields in CSV – Sublime Text 3
I have a CSV file containing info to be inserted in a database with SQL using insert similar to the below example: INSERT INTO `Person`(`name`, `occupation`, `residence`, `comments`) VALUES (GIBEL …