Community
    • Login

    Help required with regular expression

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 513 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.
    • Dominique MegardD Offline
      Dominique Megard
      last edited by Terry R

      Hi all, I am trying to extract fields from lines like this;

      La Bohème 3’40|(J. Plante/C. Aznavour)|Georges Guétary|1966 EMI Music France|Édit. Djanik Music

      Here is the regular expression I try (I know there are superfluous patterns):
      ^(.*)\d\'.*\|.*\|(.*)\|.*\|.*$

      I have tested my regex on the site regex101.com and whatever the flavor it gives me the correct result but in Notepad++ it keeps saying “cant find the text …”

      I am sure I am doing something wrong but can’t think what it is!

      Thanks in advance

      Edited by moderator as some characters in regular expression were not showing. Please read how to display code so it is not affected by the posting engine. The posts are pinned to top of most categories and in the FAQ section.

      Terry RT 1 Reply Last reply Reply Quote 1
      • Terry RT Offline
        Terry R @Dominique Megard
        last edited by Terry R

        @Dominique-Megard

        Whenever I get this problem, break apart the expression and build it up slowly. Much easier to see where the problem lies. Also suggest using .*? as a non-greedy capture. Also make sure the DOT character includes line ending option not ticked or better, use (?-s).
        I’m on phone so can’t actually assess your expression.

        Terry

        Dominique MegardD 1 Reply Last reply Reply Quote 2
        • Dominique MegardD Offline
          Dominique Megard @Terry R
          last edited by

          @Terry-R Oops, I knew it was simple, just the \' which should not have been escaped. And on the site regex101.com only the “Rust” flavor pointed it out !!!
          Thanks anyway for the tips …

          1 Reply Last reply Reply Quote 0

          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