Community
    • Login

    Or in regular expression unable to use in search

    Scheduled Pinned Locked Moved General Discussion
    regex
    4 Posts 2 Posters 1.4k 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.
    • Dinesh BabuD
      Dinesh Babu
      last edited by Dinesh Babu

      Hi,
      I am unable to use | in regular expression while searching two string ie (string 1|string 2)in search…does any one know why it’s not coming ??

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Dinesh Babu
        last edited by

        @Dinesh-Babu

        It works fine.
        For anybody to say what is going wrong for you, you’d have to present some data and a search regex.
        We’re not mind-readers here.

        Dinesh BabuD 1 Reply Last reply Reply Quote 1
        • Dinesh BabuD
          Dinesh Babu @Alan Kilborn
          last edited by Dinesh Babu

          @Alan-Kilborn

          1. in find I am giving regex as (dog | cat)
            2.opted for regular expression
            3.selecting find all in current document
            4.in search result getting 0 matches
            But dog and cat are present in my text file
          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @Dinesh Babu
            last edited by

            @Dinesh-Babu

            Hard to tell what you are REALLY doing from that.
            It appears you have extra space characters in there maybe?
            Maybe you have (dog | cat) instead of (dog|cat) ?
            Spaces ARE significant in regular expressions, unless you use the (?x) option in front, e.g. (?x)(dog | cat)

            Anyway, alternation (the | regex operator) definitely works fine:

            2e65cd6d-abca-421a-98d9-42dcbd22dc57-image.png

            I dropped the wrapping parentheses for the example, but it works just as well with them as without them.

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