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