Questions tagged [regexp-replace]
Function in Oracle, Mysql, Hive, Teradata, DB2, Snowflake, Trino, Vertica, PostgreSQL, Redshift and other databases that extends the functionality of the REPLACE function by allowing searching a string for a regular expression pattern. See also REGEXP_INSTR, REGEXP_SUBSTR, REGEXP_LIKE and REGEXP_COUNT for other functions extended to use regular expressions.
regexp-replace
1,115
questions
-4
votes
0
answers
36
views
regex is failing in first char itself [closed]
^[^\s][\/s]*[A-Z0-9][A-Z0-9\.\,\:\;\/\-]*$
above is regex if i enter M it is failing or does not match.
what changes i can make in above regex?
0
votes
2
answers
30
views
How to limit/cap values exceeding a certain value in Notepad++
I have this snippet of code in yml:
- Item: Oldman's_Romance
Rate: 50
- Item: Grasshopper's_Leg
Rate: 8000
- Item: Azure_Jewel
Rate: 9000
- Item: ...
2
votes
2
answers
47
views
reg_replace in PostgreSql with pattern matching
I have below dataset,
1. '{SHEET,2730377,SHEET,5708283,DATA,3015937}'
2. '{SHEET,2730377,SHEET,5708283,DATA,3015937,DATA,0010965}'
3. '{SHEET,5708283,DATA,3015937,DATA,0010965}'
3. '{SHEET,5708283,...
1
vote
1
answer
34
views
Optional groups not matching when it should
I'm trying to create a regex to replace the parameters |arquivourl= and |arquivodata= to use only |wayb=, so I created the following:
Find: (\{\{(?:cite|citar?).*?)(?:\| ?(?:arquivodata|dataarquivo|...
2
votes
0
answers
43
views
PHP PCRE2 conditional substitution
I'm trying to replace a string in a conditional way using preg_replace in PHP.
The idea is pretty simple and it's working in regex101, but when i try it in PHP it doesn't.
Search pattern:
^([0-9]{3})-...
0
votes
1
answer
24
views
Replace keyword in hql query and slowness
After adding replace operation to my hql query it became slower. How can I make it faster?
Products are transferred to my database with cronjob. My goal is to make a special change only to the name ...
0
votes
0
answers
20
views
RegEx issue when using to highlight specific word(s)
I have a method I use to highlight text. It takes the original string and text(s) to be highlighted and returns a formatted string. I use this to highlight text(s) user wants to search in a set of ...
2
votes
2
answers
79
views
Alternative to \p{Lo} Unicode Class in PostgreSQL Regex
I encountered a problem when working with regular expressions in PostgreSQL. It turns out that PostgreSQL has no support for the \p{Lo} class, which corresponds to the "Letter, Other" ...
1
vote
1
answer
38
views
Regular Expresssion find Comma in Redshift Database
I have a query which is having , in lname column. I want to find the , and replace it with blank. I want to use regex_substr but not getting any solution.
As of now i am able to resolve this using ...
0
votes
0
answers
18
views
Extract alphabetic_string from a field in Teradata
I have a table (table1) with some columns say (col1, col2, col3). I am trying to extract alphabetic_string from col1. The example data in Col1 is
ABCDEF, GON-F RFF RED, IV CATH INTRO 22G X 1", BD ...
0
votes
1
answer
24
views
CROSS JOIN JSON_TABLE with REGEXP_REPLACE and LOCATE not giving the correct result
I have a table with a column named tags. In this column, I have a comma-separated list like отказвам резервацията, отмяна на резервацията, etc.
My query looks like that:
SELECT * FROM products
CROSS ...
0
votes
1
answer
68
views
REGEXP replace with blank
I am exploring a database using BigQuery and following a relatively old document which is returning an error with the below query. Entries in the column in question has the form
|column1|
|:--- |
|...
-1
votes
1
answer
37
views
Using a regexp function to bring back the number immediately after specific words and needs to stop matching once it comes across non digit character
The regexp function needs to stop matching once it comes across a non-digit character, but it continues to match and doesn't stop
tried this:
regexp_replace(substr(CASE_CMT,instr(CASE_CMT,'FINAL CLAIM ...
1
vote
2
answers
95
views
Special Regular Expression match in javascript
I need JavaScript special regex pattern to convert the input string to required string.
Input String:
google.com/q=abc?param1=\[foo,bar\]&optional=true¶m2=\[bar,baz\]
Output String:
...
1
vote
1
answer
85
views
REGEXP_REPLACE not working as expected in Databricks to add spaces to string
I have a line of code to add spaces to a string after every 3 characters for a given column below:
regexp_replace(column, '(.{3})', '$1 ') as new_column
When running this code manually in SQL editor ...