skahlert2010
asked on
REGEXP_SUBSTR extraction from string
Dear experts and regular expression wizards,
I need to extract numbers with European comma seperation from a string.
For instance 4,32.
Sometimes, however, I will have a single integer such as 4 embedded in a string only.
I tried the regular expression below, which only works for comma separarated values. Can you please show me how to extract single numbers as well as.
To be precise I need a regular expression that extracts 4 and 4,32 from a string such as "The result values are 4 and 4,32! Recommended task..."
I need to extract numbers with European comma seperation from a string.
For instance 4,32.
Sometimes, however, I will have a single integer such as 4 embedded in a string only.
I tried the regular expression below, which only works for comma separarated values. Can you please show me how to extract single numbers as well as.
To be precise I need a regular expression that extracts 4 and 4,32 from a string such as "The result values are 4 and 4,32! Recommended task..."
select to_number(trim(regexp_substr(str_result,'[0-9][,][0-9]'))) str_result, decode((str_bewertung),'A+',9,'A',8,'A-',7,'B+',6,'B',5,'B-',4,'C+',3,'C',2,'C-',1) as bewertungspunkte, str_bewertung str_bewertung from (select str_typ, str_result, str_bewertung from tbl_matrix_result where LNG_GEBIET = :xp_cnt_gebiet and STR_LRT = :xp_str_lrt and INT_BE = :xp_be and INT_WG = :xp_wg and EVAL_TYPE = 4 and lower(str_typ) = 'biotopbaum' );
if the string has more than one number in it, what are you expecting the results to be? One row per value? or one column per value? The first is possible, the second is not.
Is there a maximum number of numbers you might expect? Will it be only 1 or 2 or could there be many?
Is there a maximum number of numbers you might expect? Will it be only 1 or 2 or could there be many?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks marqusG!
Brilliant! I's working great! Do you guys have a reference for regular expressions?
I am sometimes having trouble to build my own function successfully since I am exactly not fond of the parameters.
Bye!
Brilliant! I's working great! Do you guys have a reference for regular expressions?
I am sometimes having trouble to build my own function successfully since I am exactly not fond of the parameters.
Bye!
Glad to helped you. You find a good reference here http://regexplib.com and here: http://www.regular-expressions.info/
Cheers
Cheers
ASKER
Thanks! That will be quite handy in the future!
Brgds....
Brgds....
For some bug, link to accept answer and awrad points is missing. Please, skahlert2010, click Request attention link to ask a moderator to award points to my answer and close question.
Thanks and good bye
Marco
Thanks and good bye
Marco
ASKER
Thanks for the excellent answer!
Hope this helps