Questions tagged [regex-replace]

53 questions
1
vote
2 answers

How to use regexp_replace in spark.sql() to extract hashtags from string

I need to write a regexg_replace query in spark.sql() and I'm not sure how to handle it. For readability purposes, I have to utilize SQL for it. I am trying to pull out the hashtags from the table. I know how to do this using the python method but…
0
votes
1 answer

RegEx Replace for Azure AD SAML Transformation Using RegEx

Long time lurker, first time poster :-) I have an issue where our vendor does not appear to accept special characters such as hyphen (-) and apostrophes ('). Is that the plural? So in our Azure Active Directory SAML claim I need to remove the…
0
votes
1 answer

oracle - replace value in string by excluding case when value is between parentheses

i would like to do an automatic replace with an oracle query in multiple strings available in an oracle table, by changing fields separator ','between first occurrence of 'select' and first occurrence of 'from' without having impact in case is in…
Mathew Linton
  • 33
  • 1
  • 2
  • 8
0
votes
1 answer

Is there a function to replace matched string with another column's value?

Im trying to replace a matched string only - and nothing else within the column, with another value. For example: My name is GaryBrooks. The Partnertime series was good. Match: GaryBrooks Partner time Expected output: My name is…
Sid
  • 23
  • 6
0
votes
0 answers

RegEx Replaces Duplicate Character Sequences but Removes Dots and Commas Entirely (but Shouldn't)

I'm trying to write a regex for replacing sequential occurrence of specified characters with single ones. I used a backreference and character class for that. However, some of the characters (. and ,, in my case) just get completely removed (and I…
ENIAC
  • 813
  • 1
  • 8
  • 19
0
votes
1 answer

Replace nth regex match in C++

I've found this topic which only explains how to replace the first regex match. What about some n'th match? Say I have a string and a regex like these: std::string str = "fast cast dust crust must last rust"; std::regex expr = " .(a|u)st"; How…
Kaiyakha
  • 1,463
  • 1
  • 6
  • 19
0
votes
2 answers

How to replace string in column names of pyspark dataframe?

I have a pyspark data frame that every column appends the table name ie: Table.col1, Table.col2... I would like to replace 'Table.' with '' (nothing) in every column in my dataframe. How do I do this? Everything I have found deals with doing this…
user3486773
  • 1,174
  • 3
  • 25
  • 50
0
votes
1 answer

Regexreplace $ in address

I would like to get rid of "$" in several cells. A cell contains f.e. "$q$3", but I would to change it into "Q3" How to fix this with function regexreplace? Anyone? Thanks for helping!
0
votes
1 answer

How to access sql column that is in a map,string,struct,array,string

I have a table in sql that is map,string,struct,array,string. I have accessed the value by using element_at(k,v) which works. My issue is the column has values like '#"nike"#','#"REEBOK"#'. I have tried stripping the characters(,#), I have tried…
Philo
  • 31
  • 1
  • 5
0
votes
1 answer

regex stop continuous match when reach specific symbol

I want to remove character other than letters and number between two symbol which are < and > with empty string. The string is (?<=F=|\G(?!^))[A-Za-z1-9]*\K[^A-Za-z1-9]+ //output:
0
votes
1 answer

How to make function as thrid parameter of regex_replace() in C++11 above?

I was attending to replace some characters in an abnormal json string in order to make it normal, so i used regex to match it and replace it in line, the matched character need to be transformed, so is there any method to make "matching" and…
Jim
  • 767
  • 1
  • 10
  • 24
0
votes
1 answer

Highlighting dots in a string using Python's regex and termcolor causing jupyter to crash

This is a simple code which uses regex to identify a pattern and termcolor to replace the pattern with the highlighted version of the same, basically used for highlighting a required text. The code seems to work fine with almost all the patterns.…
Nithin Mohan
  • 23
  • 1
  • 5
0
votes
1 answer

Want file in CSV. I need a Regex to change a space to a comma on each line EXCEPT the Description Field which should remain with a space

Goal: I want a CSV file as my result. I want to change the space char to a comma on each line of data. BUT, I also need the data for the 3rd field (Description) to remain as is with original space chars. Each line of data is terminated with a…
0
votes
2 answers

Split email address by username and email domain

I would like to split the username and email domain from an email address. For Example, test.leo@gmail.com to test.leo and **gmail ** without .com Formula used:…
leo
  • 1
0
votes
3 answers

Extract text from a cell without extracting punctuation in Google Sheets

In Column F, I have a list of states and their abbreviations. enter image description here I want to use a regex function to extract the state and the state code so the output looks like the contents in Columns G and H. How do I do this?…
cheesebag
  • 3
  • 3