Community
    • Login

    Help with Regex/Find/Macro

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 25 Views
    Loading More Posts
    • 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.
    • João BorlothJ
      João Borloth
      last edited by

      Good morning!
      Everyone, I couldn’t understand REGEX.
      I believe there’s a REGEX solution (Find or Filter) to solve my problem.
      I need Notepad++ to search line by line and find the lines that contain:

      1. A word with all letters in uppercase (example: LTDA)
      2. A word with all letters in lowercase (example: and)
      3. A word with mixed lowercase and uppercase letters (except capitalized words) (for example, find: hoUse, HOuse, HousE)
        but NOT find House.

      This would require 3 Regex and/or 3 macros.
      Example sentences:
      My HouSe is Beautiful => Find “HouSe” and “is”
      My House Is Beautiful => Ok, Don’t find anything
      MY House IS Beautiful => Find “MY”, “IS”

      Thank you

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC
        Coises @João Borloth
        last edited by Coises

        @João-Borloth said in Help with Regex/Find/Macro:

        Good morning!
        Everyone, I couldn’t understand REGEX.
        I believe there’s a REGEX solution (Find or Filter) to solve my problem.
        I need Notepad++ to search line by line and find the lines that contain:

        1. A word with all letters in uppercase (example: LTDA)
        2. A word with all letters in lowercase (example: and)
        3. A word with mixed lowercase and uppercase letters (except capitalized words) (for example, find: hoUse, HOuse, HousE)
          but NOT find House.

        This would require 3 Regex and/or 3 macros.
        Example sentences:
        My HouSe is Beautiful => Find “HouSe” and “is”
        My House Is Beautiful => Ok, Don’t find anything
        MY House IS Beautiful => Find “MY”, “IS”

        Thank you

        Your example doesn’t quite match your statement. If, as per your statement, you want to find lines which contain one or more words that do not consist of a capital letter optionally followed by one or more lower case letters, then try:

        (?-is)^(?!\u\l*+([^\w\r\n]+\u\l*+)*+[^\w\r\n]*$).*+

        You can find them one by one, or click Find All to get a list.

        If, as per your example, you want to find words that do not consist of a capital letter optionally followed by one or more lower case letters, try:

        (?-is)\b(\u\l*+)?+\w++

        I tried to cover likely cases involving punctuation, but test. I’m not promising it’s perfect. (Come to think of it, I’m sure these will not handle words with apostrophes correctly.)

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors