Community
    • Login

    Help required with regular expression

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 59 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.
    • Dominique MegardD
      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
        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
          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
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors