Home > front end >  Regexp to search for strings like 'cpt' => on Notepad
Regexp to search for strings like 'cpt' => on Notepad

Time:01-28

I'm trying to build a list of array of mime types for PHP. I got a long list of mime types but I need to remove all the 'xxx' => upfront. How to detect them using regexp cos I tried '[\u][a-z0-9]' => and it didn't work.

    'cpt' => 'application/mac-compactpro',
    'cpt' => 'application/x-compactpro',
    'cpt' => 'application/x-cpt',
    'crl' => 'application/pkcs-crl',
    'crl' => 'application/pkix-crl',
    'crt' => 'application/pkix-cert',
    'crt' => 'application/x-x509-ca-cert',
    'crt' => 'application/x-x509-user-cert',
    'csh' => 'application/x-csh',
    'csh' => 'text/x-script.csh',
    'css' => 'application/x-pointplus',

CodePudding user response:

Try this .... Find:^\s*'\w ' =>
Replace with:empty

enter image description here

CodePudding user response:

You may try the following find and replace, in regex mode:

Find:    ^\s*'.*?'\s*=>\s*('.*?',?)$
Replace: $1

Demo

CodePudding user response:

Let's keep it simple. You need to search for ^\s*'\w\w\w' =>

Don't forget to set the Search Mode to Regular Expression in the search dialog.

  •  Tags:  
  • Related