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..."
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' );

Open in new window

Who is Participating?
Marco GasiConnect With a Mentor FreelancerCommented:
You can try this: (\d[^,])+|(\d+,\d+)+

Shinesh PremrajanTechnical ManagerCommented:
select to_number(trim(regexp_substr(str_result,'[0-9,]'))) str_result

Hope this helps
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?
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

skahlert2010Author Commented:
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.

Marco GasiFreelancerCommented:
Glad to helped you. You find a good reference here and here:

skahlert2010Author Commented:
Thanks! That will be quite handy in the future!

Marco GasiFreelancerCommented:
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

skahlert2010Author Commented:
Thanks for the excellent answer!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.