Help required with regular expression
-
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.
-
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
-
@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 …