Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We follow our own defined coding standard (Hungarian notation) as per our checklist, using Notepad++:

  1. Check that all variables are valid according to Hungarian notation identifier naming convention, and match & highlight invalid Hungarian notation variables syntax:

    String variables should start with s as follows:

    String sTest = null;   
    

    For int it should be i:

    int iCount = 0;  
    

    If there is a variable String Test = null; or a variable int Count = 0; I want to highlight them as they don't start with s and i.

share|improve this question

migrated from askubuntu.com Aug 26 '12 at 11:09

This question came from our site for Ubuntu users and developers.

    
In the future, please don't cross-post your questions. Ask them on one site, and if they're off topic they will be migrated anyway. Thanks! – slhck Aug 26 '12 at 11:15

I suppose you are looking for a Regular Expression to match (and highlight) all the cases you describe.

  • This Regex will match any String variable initialization that doesn't have the character s in the beginning of its name: String [^s].*?;

  • This Regex will match any int variable initialization that doesn't have the character i in the beginning of its name: int [^i].*?;

  • This Regex combines both of them: String [^s].*?;|int [^i].*?;

    (RegExr Test)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.