Community
    • Login

    Or in regular expression unable to use in search

    Scheduled Pinned Locked Moved General Discussion
    regex
    4 Posts 2 Posters 2.6k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors