Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL: Regular Expression

SQL: Regular Expression

Scheduled Pinned Locked Moved Database
databaseoracleregextutorialquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lash20
    wrote on last edited by
    #1

    to Mc[X]? (e.g. convert Mcgovern to McGovern, Mcdonald to McDonald) in Oracle (or just SQL code)? I tried using the regexp_replace function in Oracle, but can't quite figure out how to upper case the third character. Thanks

    L 1 Reply Last reply
    0
    • L Lash20

      to Mc[X]? (e.g. convert Mcgovern to McGovern, Mcdonald to McDonald) in Oracle (or just SQL code)? I tried using the regexp_replace function in Oracle, but can't quite figure out how to upper case the third character. Thanks

      L Offline
      L Offline
      Lash20
      wrote on last edited by
      #2

      Though not elegant, I was able to do the following:

      select regexp_replace(d_name,'Mc[a-z]', 'Mc' || upper(substr(d_name, 3, 1))) n from
      (
      select 'Mcfix' d_name from dual
      );

      Thanks

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups