topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday November 1, 2024, 5:12 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA:two options text manipulation tool  (Read 6133 times)

rapstar

  • Participant
  • Joined in 2011
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
IDEA:two options text manipulation tool
« on: May 17, 2011, 11:39 AM »
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
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, 11:43 AM by rapstar »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: IDEA:two options text manipulation tool
« Reply #1 on: May 17, 2011, 12:05 PM »
Do you already have a list of artists you want to search?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA:two options text manipulation tool
« Reply #2 on: May 17, 2011, 03: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

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: IDEA:two options text manipulation tool
« Reply #3 on: May 17, 2011, 03: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
    • View Profile
    • Donate to Member
Re: IDEA:two options text manipulation tool
« Reply #4 on: May 17, 2011, 04: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.)

rapstar

  • Participant
  • Joined in 2011
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: IDEA:two options text manipulation tool
« Reply #5 on: May 19, 2011, 01: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
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, 01:15 PM by rapstar »

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: IDEA:two options text manipulation tool
« Reply #6 on: May 19, 2011, 01: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
([^\?]+)\?([^&]+).*
with
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.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA:two options text manipulation tool
« Reply #7 on: May 19, 2011, 02: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, 02:02 PM by MilesAhead »