DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA:two options text manipulation tool  (Read 8,370 times)

rapstar

  • Participant
  • Joined in 2011
  • *
  • Posts: 2
IDEA:two options text manipulation tool
« on: May 17, 2011, 04:39 PM »
Hey, i need a simple tool which manipulates text strings. Two options are crucial: a) add needed text in the beginning of each line and b) replace everything from text to find till the end of the line with desired text.

I guess this could be done in like notepad++ with regexps but i failed to make an expression.

My strings are like
Quote
mp3search.com/search.php?artist=Janis+Joplin
and i need to add http:// in the beginning of each line and replace from artist= till the end of string with what i want... used to work manually, bit here come thousands of 'em  :-\

« Last Edit: May 17, 2011, 04:43 PM by rapstar »

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: IDEA:two options text manipulation tool
« Reply #1 on: May 17, 2011, 05:05 PM »
Do you already have a list of artists you want to search?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: IDEA:two options text manipulation tool
« Reply #2 on: May 17, 2011, 08:31 PM »
Many clipboard tools can do this kind of thing, including my Clipboard Help+Spell.  They are a bit overkill if you don't need the clipboard and text formatting features regularly.

ps. Thumbs up for Janis Joplin, one of the greats  :up:

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: IDEA:two options text manipulation tool
« Reply #3 on: May 17, 2011, 08:39 PM »
I was going to offer my ListNumberer app as a way to do what he wants.  He can just paste in his list of search terms and then use "http://mp3search.com/search.php?artist=" as a prefix.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • Cody Award
    • Official Forum Clown
    • rotten turkey sandwich - Rotten Turkey Sandwich
Re: IDEA:two options text manipulation tool
« Reply #4 on: May 17, 2011, 09:27 PM »
I was going to offer my ListNumberer app as a way to do what he wants.  He can just paste in his list of search terms and then use "http://mp3search.com/search.php?artist=" as a prefix.

And a very nice app it is too.  :up: :up:    (Just the job for this task.)
Chris

rapstar

  • Participant
  • Joined in 2011
  • *
  • Posts: 2
Re: IDEA:two options text manipulation tool
« Reply #5 on: May 19, 2011, 06:01 PM »
list numberer worked like a charm when i needed to add the same string to the beginning

*except it looks weird if you put like 140% scale in your win xp

for my second replacement need, it's no just adding things in the end, i need to search for given expression and then replace everything till the end of the line, expression itself included

actually it's not like search.php?artist= in the end, url i get from parsing are like
Quote
search.php?artist=Patti+Smith&onetwo=true&areyousure=yes&hash=5655434&clientid=12343&
so i want to get rid of unnesessary paremeters

going to try Clipboard Help+Spell, many thanks
« Last Edit: May 19, 2011, 06:15 PM by rapstar »

Jibz

  • Cold Warrior
  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Participated in NANY Challenge Four Times
Re: IDEA:two options text manipulation tool
« Reply #6 on: May 19, 2011, 06:41 PM »
I don't know if I understood exactly what you wanted to replace, but in Notepad++ maybe something along the lines of replace
Code
([^\?]+)\?([^&]+).*
with
Code
http://\1?\2
(make sure regular expression is ticked).

I.e. grab everything up to the first ? on the line and store that in \1, grab everything after that and up to the first & and put that in \2, match the rest of the line to get that removed.
"A problem, properly stated, is a problem on it's way to being solved" -Buckminster Fuller
"Multithreading is just one damn thing after, before, or simultaneous with another" -Andrei Alexandrescu

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: IDEA:two options text manipulation tool
« Reply #7 on: May 19, 2011, 07:01 PM »
There are many editors that can use either regular expressions as Jibz noted, or their own symbolic pattern characters, that can replace pattern with text or include the pattern in the replacement.  Although you tend to encounter them more on other OS.  Windows freeware editors tend to be more limited.

You may want to try one of the Windows ports of vi. That editor can do some amazing things in command mode if you don't mind jumping in and out of edit mode.  Can make you a bit schizoid but if you are really into complicated editing you may not mind. :)

I never got really adept at vi but when I was playing with Linux a lot I used it enough to start to see the versatility.
« Last Edit: May 19, 2011, 07:02 PM by MilesAhead »

Original address: https://www.donationcoder.com/forum/index.php?topic=26780.0