question
-
hi guys i have a question
i have paragraph
bla blabla {suka|tidak|menyapa} blablbalba
blablablaba {melihat|dilihat} blablabla
blablablab {teriak|ditempeleng|jualan|murah} blablabla
blablabla {ketek|joker|koper|nakal} blablabawhat i want is the last word
bla blabla menyapa blablbalba
blablablaba dilihat blablabla
blablablab murah blablabla
blablabla nakal blablabai hope u understand ,thank you very much
-
Hi, @upay an All,
Easy with regular exrpressions !
-
Open the Replace dialog (
Ctrl + H) -
SEARCH
(?-s)\{.+\||\} -
REPLACE
Leave EMPTY -
Tick the
Wrap aorundoption, if necesaary -
Clik on the
Replace All
Notes :
-
I assume that your text contains only one range
{...|....|....}, per line -
The search regex looks for two patterns, separated with the
|alternation symbol -
The
{and}braces, as well as the|symbol, are special characters in regex syntax, so it must be escaped with\to be seen as literal chars -
The
(?-s)part, forces the regex engine to see the regex char.as matching a single standard char ( not EOL ! ) -
Then the part
\{.+\|looks for an opening brace{till the last|symbol, of each line -
The second pattern is simply
\}which matches an ending brace char -
As replacement zone is empty, these two patterns are deleted
Best Regards,
guy038
-
-
@guy038 it works , thanks…but i forget to explain more…
actually i cant speak english i hope u understand :(for example
Belajar {dari|berasal dari} {kesalahan|kekeliruan} musim sebelumnya, RRQ {terhadap|pada|dilakukan} MPL Season 2 seakan tak terbendung oleh tim lain. Dia {cuma|sanggup} melihat {dari jauh|apaya}.
what i want is the last word, but other words not be deleted
if not understand,what i want is the paragraph will be like thisBelajar berasal dari kekeliruan musim sebelumnya, RRQ dilakukan MPL Season 2 seakan tak terbendung oleh tim lain. Dia sanggup melihat apaya.
thank you very much i really appreaciate,
-
Hi, @upay an All,
Ah, OK ! Then, assuming that your text do not contain ranges
{.............}, split on two lines as, for intance :{terhadap|pada| dilakukan}A possible solution would be :
SEARCH
(?-s)\{.+?\|([^|]+)\}REPLACE
\1
If we use the
free-spacingmode, the regex, with some explanations in comments, can be rewritten as :(?x-s) # Search in FREE-SPACING ( SPACE char NO SIGNIFICANT ) and NO SINLE LINE modes ( DOT = a SINGLE STANDARD character ) \{ # An OPENING brace .+? # The SHORTEST NON-NULL range of STANDARD chars... \| # ...Till an ALTERNATION symbol ( # Beginning of GROUP 1 [^|]+ # GREATEST NON-NULL range of characters, ALL DIFFERENT from an ALTERNATION symbol... ) # End of GROUP 1 \} # ...Till an ENDING brace # In replacement, \1 stands for the contents of GROUP 1Best Regards,
guy038
-
An alternative and graphical approach to @guy038’s efficient regex solution. The approach needs @Ekopalypse Python script, posted here and, of course, the Python plugin installed:

Words were marked by a regex expression just for visual reasons.
Have fun!
-
@guy038 it works, like what i want… thank you very muchh :) :)
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