in a list, remove all text before character
-
Hi :)
I have a big list like:DONNE\Ambra\2009 - Ce n’è per tutti
DONNE\Argento Asia\1995 - De Generazione
UOMINI\BBarboro\2004 - La spettatrice
VIDEO\Buy Margherita\2004 - I giorni dell’abbandonoI want remove all before the " - " for have
Ce n’è per tutti
De Generazione
etcis possible? Many thanks :)
-
Find:
(?-s)^.*?-
Replace: nothing
Search mode: Regular expression -
-
@Alan-Kilborn I’m trying to understand why
(?-s)is needed here. I think in normal cases it can be omitted and is only needed if the. matches newlinecheckbox is checked, isn’t it? -
@datatraveller1 said in in a list, remove all text before character:
I’m trying to understand why (?-s) is needed here.
Speaking for myself (but I think others will agree). When providing a solution for someone, as soon as the DOT character is involved the
(?s)or(?-s)is generally the first bit of code to put on paper. It just makes good programming sense (yes regex isn’t a programming language).I’ve even been known to leaving it in, even when not required. It doesn’t hurt to do so.
Terry
-
Terry is right, but the shorter version is that it saves me from having to write my response this way:
Find:
^.*?-
Replace: nothing
Search mode: Regular expression
. matches newline checkbox: UncheckedAs you can see, many less characters to type for me to simply use
(?-s)BTW, for those that don’t know, if the
. matches newlinebox is checked, it effectively puts a(?s)at the start of whatever regular expression you supply in the Find what. So if your regular expression supplied is(?-s)^.*?-it becomes(?s)(?-s)^.*?-which is really just(?-s)^.*?-because the(?-s)part “undoes” what the leading(?s)does.
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