• Login
Community
  • Login

Or in regular expression unable to use in search

Scheduled Pinned Locked Moved General Discussion
regex
4 Posts 2 Posters 1.5k 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.
  • D
    Dinesh Babu
    last edited by Dinesh Babu Jun 27, 2021, 4:22 PM Jun 27, 2021, 4:21 PM

    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 ??

    A 1 Reply Last reply Jun 27, 2021, 4:49 PM Reply Quote 0
    • A
      Alan Kilborn @Dinesh Babu
      last edited by Jun 27, 2021, 4:49 PM

      @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.

      D 1 Reply Last reply Jun 27, 2021, 6:11 PM Reply Quote 1
      • D
        Dinesh Babu @Alan Kilborn
        last edited by Dinesh Babu Jun 27, 2021, 6:12 PM Jun 27, 2021, 6:11 PM

        @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
        A 1 Reply Last reply Jun 27, 2021, 7:45 PM Reply Quote 0
        • A
          Alan Kilborn @Dinesh Babu
          last edited by Jun 27, 2021, 7:45 PM

          @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
          4 out of 4
          • First post
            4/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors