REGEXP_REPLACE remove the comma in double quotes
Hello
I am trying to remove the comma of a string in double quotes, currently I can only remove a comma using under sql
SELECT REGEXP_REPLACE (' "" A, B, C, def "', '(") ([^ "|,"] +) (,) ([^ ""] +) ("") ',' \1\2 \4\5' ') FROM DUAL;
output: 'A B, C, def'
But I need the form "A B C def".
Hello
Jarkko Turpeinen wrote:
... I think that I stop to answer here, because I don't understand of course questions
Very understandable. If my assumption is correct, the question would be much clearer if OP gave an example that included a few commas inside the quotation marks and some outside, as in the example below.
Here's a way to implement what I have described in the answer #2 above:
VARIABLE input_txt VARCHAR2 (100)
EXEC: input_txt: = 1, '2', ' A, B, C, def ", 3" foo, bar '4 ';
WITH got_parts AS
(
SELECT LEVEL AS part_num
, REGEXP_SUBSTR (: input_txt)
, '[^"]*("|$)'
1
LEVEL
) AS part_txt
OF the double
CONNECT BY LEVEL<= 1="" +="" regexp_count="" (="">=>
, '"'
)
)
SELECT LISTAGG (CASE
WHEN MOD (part_num, 2) = 0
THEN REPLACE (part_txt, ',')
Of OTHER part_txt
END
) Within AS output_txt GROUP (ORDER BY part_num)
OF got_parts
;
Tags: Database
Similar Questions
-
REGEXP_REPLACE remove the start and end quotes.
Hello guys,.
I have a problem with my regular expression and I hope someone can help me with this?
Imagine the following sample_data:
{code}
WITH sample_data AS
(
SELECT "'[email protected] "' double UNION ALL e
SELECT "'[email protected] ' double UNION ALL e
SELECT ' [email protected] "' double UNION ALL e
SELECT "'[email protected] "' double UNION ALL e
SELECT ' [email protected] "' double UNION ALL e
SELECT "'[email protected] ' like e dual FROM
)
SELECT e, REGEXP_REPLACE (e, '(^'')? (. *) (''$)', '\2')
OF sample_data;
{code}
I would like to remove all the quotes of beginning and end of the email. I made previous regexp, but she does not return the correct result. I know not why, but for some reason, when my email ends with a quote, the main quotation is not deleted.
Can someone help me with this?
Thank you
Another solution...
WITH sample_data AS (SELECT '''[email protected]''' AS e FROM DUAL UNION ALL SELECT '''[email protected]' AS e FROM DUAL UNION ALL SELECT '[email protected]''' AS e FROM DUAL UNION ALL SELECT '''[email protected]''''' AS e FROM DUAL UNION ALL SELECT '[email protected]''' AS e FROM DUAL UNION ALL SELECT '''''[email protected]' AS e FROM DUAL) SELECT e, REGEXP_REPLACE (e, '(^''+)|(''+$)') FROM sample_data
-
Regular expression, replace all commas between double quotes ONLY
Hello
I want to remove all commas between double quotes:
I tried under model, but it does not replace all if we have more than one comma in double quotes.
SELECT REGEXP_REPLACE (123, "45.6" Hello, "John, Mike, Marc", 456, "-Anne, Anna"', ' "([^"]*),([^"]*)" ', '"\1;\2" ', 1, 0) suite
FROM DUAL;
Result
--------------------------------------------------------------------------
123, '45; 6"," Hello, "John, Mike;" "Marc", 456, "Anne-; Anna.
the first comma between 'John, Mike; Marc"is not replaced...
Recursion can do if you insist on the SQL solution
with
correct (INP, orig, CNT, res, Step) as
(select str,
substr(STR,2),
-case when substr (str, 1, 1) = ""' then 1 else 0 end,
substr (STR, 1, 1),
1
of (select 123, '45.6,' Hello, ' John, Mike, Marc ", 456, '-Anne, Anna', 'single_value' ' str of union double all the)
Select "123456789" across double Union
Select ' ""' of all the double union
Select "" 123,456,789"" Union double all the
Choose 123, '45.6,' Hello, ' John, Mike, Marc ", 456, 'Ann-Marie, Anna', 'unique value' ' double str
)
Union of all the
Select the inp
substr(orig,2),
CNT + case when substr (orig, 1, 1) = ""' then 1 else 0 end,
RES | cases where substr (orig, 1, 1) = ','
so to case when mod(cnt,2) = 1
then ' ~'
else «»
end
of another substr (orig, 1, 1)
end,
Step + 1
Rectifier
where orig is not null
)
Select the inp, res
Rectifier
where the orig is null
INP RES "" "" 123456789 123456789 "123456789". "123 ~ 456 ~ 789". 123, '45.6' Hello, ' John, Mike, Marc ", 456, '-Anne, Anna', 'single_value '. "123," "45 ~ 6 ', Hello," John ~ Mike ~ Marc ", 456," Anne-~ Anna ',' single_value '. 123, '45.6' Hello, ' John, Mike, Marc ", 456,"Ann-Marie, Anna","unique value ". "123," "45 ~ 6 ', Hello," John ~ Mike ~ ~ ~ Marc ', 456,' Anne-Marie ~ Anna "," unique value ". Concerning
Etbin
-
How to remove the comma in 65 321...
Hello
I want to remove the commas of the variables.
for example,.
Str = 65 321
herein, I need to remove the comma. My str therefore 65321. y at - it any accumulation of functions...
Thanks in advance,
Sathya N.
stringwithoutcommas = stringwithcommas.split(",").join("");
-
Remove the comma (,) of chain
Hello friends,
I have a string something of this nature
Sting: ", 3456, 45454, 45454,"
Need to have just the values separated by commas: '3456,45454,45454'
Tried with replace, but go to-'34564545445454'
Select Replace (ltrim (RTRIM (replace (', 3456, 45454, 45454,', ',', ','), ',')), ",", ") twice;
Appreciate your help.
Thank you/KumarAlmost there but your exterior replacement remove all commas. What you need is
select ltrim(RTRIM(replace(',3456,45454,,45454,', ',,', ','),','),',') from dual;
Replace it replaces all double commas with a single comma, then RTRIM strips off the commas from the end of the string and the LTRIM removes any comma out of the beginning of the string. Unfortunately this does not always work if you have more than two consecutive commas in your channel. In order to replace two or more commas with a single comma, you will need to use regexp_replace.
-
Remove the comma from parting with something else in a file download
I have a file which gets downloaded and then read and inserted into the database. The problem is when I read below records that should be of 3 indices, it breaks the index with the file delimited by commas in 5 index.
«"", "", "Wonderful expanded s Cape, with 4/5 bedrooms 2 full wait. Eik, Lr, Grand Place, news»
How can I replace the comma in the file once downloaded and use that delimiter in my ListToArray.
< cfloop index = list "ind" = "" #readlistings # "delimiters =" #chr (13) ##chr (10) #">"
< cfset i = ListToArray (ind, ",", true) / >
< cfoutput >
#i [4] #.
< br > < br >
< / cfoutput >< / cfloop >
To recover the data of embedded quotes, you can use the following URL by passing your conataining the commas as the argument string.
-
Remove the commas (-) of numbers entered by the user in a field
Hello world
How can I filter the commas of a number entered by a user into a text input field? I'm doing calculations with these numbers entered, but if the user enters a comma, I get "NaN" (not a number) as the result of what the user has entered.
I could prevent the user to enter commas in fields (I'm already restriciting enter letters and periods), but it would be nice if the user can always use commas.
the code I have so far is:
q4input = q4_mc.q4_ans.text;
q4_preCalc = (Number(q4input)*1000);
trace(q4_preCalc);Thanks in advance for your help.
Rafael.
Try:
q4input = q4_mc.q4_ans.text.replace (",", "");
-
remove the string in double paragraph
Hi, I wandered if someone had the best way to search for a string and delete the repeated subsections.
For example, the input string may look like:
T2, T2, T3, T6
but I want to delete one of the T2 repeated, so the output would be:
T2, T3, T6
Note that the input string can be any length and a multiple of 4. I went through all the string functions and find nothing to match what I'm asking. I tried to use "String subset" in a wired loop in an output table.
Any help in the right direction would be appreciated!
Here's a handy dandy little tool that does just that. The strings must be delimited by commas. It is in LV2009. If you do not, save the file and send it to the thread Downconvert VI ask.
-
I looked through some 50 pages and did not find the answer.
I have a 8 GB Fuze w / additional removable 8 GB. By mistake I put a few same songs on both discs. What is the best way to remove these and if I do not remove them, she also ruin added playlists?
Thank you
Connect it to your computer, set up 2 separate workstation boxes, one to an intern to exteranal and scroll down... delete the dupes of one of the disks and problem solved
Edit: I forgot you questions about playlists of pesky things I barely use. Those that you might have to re-do.
-
How to get the comma in the number format?
Hi all
I have a requirement to obtain a number with commas.
I achieved this goal using the converter. (< groupingUsed = "true" integerOnly = "true" minFractionDigits af:convertNumber = '2' maxFractionDigits = "2" / >)
My textbox is limited to 5, if I give the number like 12345 then it appears in the form 12,345.00 (which is expected)I want to change the same number from 5 to 6. so if I remove the number 5, the comma is also taking as a character and not allowing me do not enter 6 in the end.
If I remove the comma, then only it is allowed me to type 12346.
I tried to delete the comma using javascript using the function that is called from clientListener below.
< af:clientListener method = "removeComma" type = 'focus' / >
function removeComma (evt) {}
var currentValue = document.getElementById('r2:1:it8::content').value;
var currentValue.replace = newValue (/ a, / g, ");
document.getElementById('r2:1:it8::content').value = newValue;
}Using this script comma was deleted at the time of change, but after changing the number and press ENTER key so I get no comma.
I wrote this code in pagefragment and my version of jdev is 11.1.2.4.0.
Help, please.
Kind regards
Shakur.
Try to remove maximumLength = "5" inputText and use af:validateLength as:
-
remove the decimal of an equation to send to a payment gateway
I have a value currently shows a decimal number
@$amount = $_POST ["amount"];
I need the decimal to show until the $amount variable is sent to the payment gateway
What is the best way to remove the comma from the variable
so an example value
250.59
will be sent as 25059
Thank you
Replace the decimal "." with nothing else using str_replace().
$amount = str_replace(".","",$amount);
best,
Shocker
-
The following comand strives to define a substitution variable that keeps the double quotes.
change the FinRptg.FinRptg database variable value CurFcstYr1 ' '2011 "";
If the variable is "2011".
What I want to do is the same thing, but using a variable. However, when I use the command:
change the database to the CurFcstYr1 the FinRptg.FinRptg value variable ""$3 ";
The variable is set to "$3".
Is there a way I can set the variable substitution using the variable I pass in the MaxL script and have the double quotes. The reason why I'm doing this is because the report script that uses the subvar must double quotes, or he does not see the year.
Thank you.Reading of:- Re: Maxl variable def with quotes
It should give you the answer on how to do it.See you soon
John
http://John-Goodwin.blogspot.com/ -
Hi all
I want a query to remove the decimal point in a number.
That is to say) 3.21 = 321
.21 = 21
1 = 1
76.667 = 76667
In all this I just want to remove the comma preceding.
Please help me to write the query
Thank you
JOTO_NUMBER (Replace(3.21,'.'))
Kind regards
Florian... -
How to remove the character within a text.
How to remove the character within a text.
If I have a text like: "[4, 5, 6, 3, 9]" How can I remove the commas?
Thank you
and Merry Christmas.A possible technique would be to use a repetition structure that loop until all of the commas are removed:
on mouseUp me
theString = '[4, 5, 6, 3, 9].
Repeat while theString contains «,»
thePos = offset ("," rope)
delete theString.char [thePos]
end repeat
put the rope
end mouseUpHowever, this probably isn't the most effective technique if you are dealing with very long strings.
If you use the JavaScript syntax, you can strip characters with a regular expression.
-
remove the double quotes in a value
DB version: 10g / 11g
Table customer_address
column: adresse_rue
data in the example: 'MLK 1234 drive '.
'dr North 150, st #600'
'o Henry 15678 dr.
Update: reader of MLK 1234
150 north dr, st #600
Dr. Henry o 15678
I'm looking to remove the double quotes (""), if this is the first and the last character.
It would be nice to get these lines with values begins and ends with double-quotes
Thank you for your time
Published by: nydba on March 22, 2012 09:02One way:
with a as (select '"1234 MLK drive"' x from dual union select '5678 JFK drive' from dual) select a.*,substr(x,2,length(x)-2) from a where x like '"%"'; X SUBSTR(X,2,LENGTH(X)-2) ---------------- ----------------------- "1234 MLK drive" 1234 MLK drive
There is probably a more efficient way with regular expressions.
Maybe you are looking for
-
Swap the menu bookmarks with the Bookmarks button 'star'.
There are a lot of answers there to get rid of the star on the new Favorites menu button button, and I share their frustration. However, my complaint is that I don't like the star button on the left of the double button. Is there a a way to replace t
-
Satellite U400-03 s - how downgrade from Vista to XP?
Hi guys,. I bought laptop Toshiba Satellite U400/03 s with pre-installed Vista Business and I want to downgrade to Windows XP Professional. My laptop comes with a professional the product for Windows XP Recovery disk, but I don't know how to use this
-
Array of strings of text written in the worksheet in LabView 8.0
Hello I've used LabView 8.5 to perform the next action, but as I am now working on another system I'm currently forced to use LabView 8.0 (Windows XP) and would like to avoid the upgrade to LV8.5 +. However if I can't do the following so I'll have to
-
The two foregoing appeared on my computer in the last 24 hours, asking for me to install and fix the problems. The MCP said Microsoft partner gold Application Development, asking to scan my computer. AMD said that she had detected that the driver was
-
Initially, there was an option to use two songs I have that my alarm or choose integrated alarm signalsBut by mistake I clicked on the always just the once optionNow please let me know how to cancel it