srini
srini

Reputation: 383

Regular expression in Oracle

I want to fetch a string pattern in column of table. I am using a query like

select CALCULATION_DETAILS 
  from DS_ELEMENT_CALC_PROPERTY 
 where REGEXP_LIKE(CALCULATION_DETAILS, 'fm.get');

I am not able to figure out the exact regexp for my requirement.

CALCULATION_DETAILS is clob and it contains a very lengthy string of JavaScript code. It has a syntax like fm.get('11abc') or fm.get('11') or fm.get('ab1c') or fm.get('abc')t.

I want to fetch the CALCULATION_DETAILS which has fm.get('11abc') or fm.get('111') means which starts with numbers inside to fm.get().

Upvotes: 2

Views: 313

Answers (1)

Vikdor
Vikdor

Reputation: 24124

Are you looking for the following?

SELECT
    CALCULATION_DETAILS 
FROM 
    DS_ELEMENT_CALC_PROPERTY 
WHERE
    REGEXP_LIKE(CALCULATION_DETAILS, 'fm.get\(''[0-9]+'

pattern for which has one or more spaces inside to fm.get(). ex: fm.get('ab d') or fm.get('ab d ed d')

SELECT
    CALCULATION_DETAILS 
FROM 
    DS_ELEMENT_CALC_PROPERTY 
WHERE
    REGEXP_LIKE(CALCULATION_DETAILS, 'fm.get\(''[a-zA-Z0-9] [a-zA-Z0-9 ]+''\)')

Upvotes: 2

Related Questions