Search code examples
regexoracle-databaseregexp-replace

reluctant quantifier using oracle regexp


I have a string '''val1'',''val2''' that I want to convert to 'upper(''val1''),upper(''val2'')' ... so I decided to use regex_replace ..... the problem is that I am not able to create a reluctant pattern .... the following pattern regexp_replace('''val1'',''val2''','(''.*'')','upper(\1)') is greedy and hence produces 'upper(''val1'',''val2'')' ... any help ?


Solution

  • According to RegexBuddy, normal lazy quantifiers should work:

    regexp_replace('''val1'',''val2''','(''.*?'')','upper(\1)')