reg-ex to clean txt file
-
hi there, i have some txt like this:
IMK_24346_0144545_474.aps 9162 FG - https://www.shopper.com/file/kahste 7-20200510.rag 216d2 FA - https://www.shopper.com/file/4dLfhgfj6 IMQ_20wa226_012349_113.ras 20.44 SB - https://www.shopper.com/file/ba211 IMR_2234r22_056305_111.raq 1823 KH - https://www.shopper.com/file/dO3a6b IEG_2214406_123258_0140.rak 21.11 OG - https://www.shopper.com/file/mosd32
i need to clean lines and text, and have only address link, like this:
https://www.shopper.com/file/kahste https://www.shopper.com/file/4dLfhgfj6 https://www.shopper.com/file/ba211 https://www.shopper.com/file/dO3a6b https://www.shopper.com/file/mosd32
someone have a right reg-ex for this?
thanks a lot for your help -
@cisco779k
Why not convert all spaces to newlines. Then bookmark all lines with http. Then remove all non bookmarked lines.Terry
-
After Terry’s suggestion, you may want to execute this replacement operation:
Find:
(?-is)^.+?(?=https:)
Replace: nothing
Search mode: Regular expressionto remove what occurs before
https
on your lines. -
@ Terry
thanks for your reply, but not easy for me follow your suggestion. you can provide and example?
or you talk about Edit - Line operations - Remove empty Lines ?@ Alan
thanks also for your reply. your regex can work. i need only to understand the first step … -
Oops. Terry’s suggestion will work, without my add-on.
-
Terry’s solution involves:
Find:
\x20
Replace:\r\n
Search mode: Regular expressionThen, Search menu > Mark with Find:
https
.Then Search menu > Bookmark > Remove Non-Bookmarked Lines.
-
@Alan-Kilborn
Just an addendum to this solution: it won’t work unless you checkBookmark line
on theMark
menu, because that is not checked by default. -
@Mark-Olson said in reg-ex to clean txt file:
Just an addendum to this solution: it won’t work unless you check Bookmark line on the Mark menu
Yep, for sure, meant to mention that…I just didn’t. :-)
Thanks for picking me up. -
oh yes Alan, your tip work like a charm
and thanks also to Mark Olson for your clarification -
i’ve saved all steps to new macro, and this work fine.
also i’ve noticed that the macro is saved on shortcuts.xml file.
I wonder if you can save the macro to a separate file … (to not to forget it in the future) -
Firstly, you have been a member of this forum since August 2017, so at least 5 years. You have asked a number of regex related questions and received answers in all cases.
You have been requested to start learning regex, see here, that was over 2 years ago, yet you still don’t appear to have learnt even the basics.
I supplied my solution last night via a smartphone, hence the shortness of the post. But I at least expected you to understand how to use that to solve your question.
I must say you appear to have been lucky in getting so many solutions. Normally we request users in your position to have at least tried to figure out an answer. Then present us with what you tried.
How about trying to learn now!
Terry
-
… useless polemic …
on my first post, i’ve ask help for a regex to my trouble. very hard for me.
maybe i would have at this solution on my own
(but thanks anyway to Alan for your support) -
@cisco779k said in reg-ex to clean txt file:
but thanks anyway to Alan for your support
You’re welcome but I agree with Terry.
You need to start learning how to do such things.
For some reason I didn’t check your posting history before contributing thoughts to this thread. -
@cisco779k ,
You seem to have quite a vocabulary for a non-english speaker, so try using your intelligence for learning regex, rather than crying for help and using $20.00 word swipes at the volunteers, who I wouldn’t blame for letting your posts die from neglect from here on out. And yes, polemic fits this post just fine.