Regex - make text uppercase for lines starting with two dashes

Viewed 29

Taking this example SQL:

-- #############################################################################
-- awt rate definitions
-- #############################################################################

        select hou.name org
             , hou.short_code org_code
          from ap_awt_tax_rates_all aatra
          join fnd_user fu1 on aatra.created_by = fu1.user_id
          join fnd_user fu2 on aatra.last_updated_by = fu2.user_id
          join hr_operating_units hou on aatra.org_id = hou.organization_id
     left join ap_suppliers pv on aatra.vendor_id = pv.vendor_id
     left join ap_supplier_sites_all pvsa on aatra.vendor_site_id = pvsa.vendor_site_id
         where aatra.tax_rate = 30;

-- #############################################################################
-- invoices with awt rate against the invoice lines
-- #############################################################################

        select aia.invoice_id id
             , aia.invoice_num num
             , haou.name org
             -- , aila.*
          from ap.ap_invoices_all aia
          join ap.ap_invoice_lines_all aila on aia.invoice_id = aila.invoice_id 
          join hr_all_organization_units haou on aia.org_id = haou.organization_id
          join ap.ap_awt_groups aag on aila.awt_group_id = aag.group_id
          join ap.ap_awt_tax_rates_all aatra on aag.group_id = aatra.tax_rate_id
         where 1 = 1
           and aatra.tax_rate = '30'
           and 1 = 1;

How can I use a Regular Expression in Notepad++ to make any text after two dashes (--) uppercase, to end up with :

-- #############################################################################
-- AWT RATE DEFINITIONS
-- #############################################################################

        select hou.name org
             , hou.short_code org_code
          from ap_awt_tax_rates_all aatra
          join fnd_user fu1 on aatra.created_by = fu1.user_id
          join fnd_user fu2 on aatra.last_updated_by = fu2.user_id
          join hr_operating_units hou on aatra.org_id = hou.organization_id
     left join ap_suppliers pv on aatra.vendor_id = pv.vendor_id
     left join ap_supplier_sites_all pvsa on aatra.vendor_site_id = pvsa.vendor_site_id
         where aatra.tax_rate = 30;

-- #############################################################################
-- INVOICES WITH AWT RATE AGAINST THE INVOICE LINES
-- #############################################################################

        select aia.invoice_id id
             , aia.invoice_num num
             , haou.name org
             -- , aila.*
          from ap.ap_invoices_all aia
          join ap.ap_invoice_lines_all aila on aia.invoice_id = aila.invoice_id 
          join hr_all_organization_units haou on aia.org_id = haou.organization_id
          join ap.ap_awt_groups aag on aila.awt_group_id = aag.group_id
          join ap.ap_awt_tax_rates_all aatra on aag.group_id = aatra.tax_rate_id
         where 1 = 1
           and aatra.tax_rate = '30'
           and 1 = 1;

I have tried:

  • Find: ^--.*
  • Replace With: \U

I also tried:

  • Replace With: \U$1

But my attempts at the replace remove the lines starting with -- completely rather than changing the case of the text.

I have done some work on https://regex101.com/ to attempt to resolve my issue but was not able to make any progress.

0 Answers
Related