mIRC Home    About    Download    Register    News    Help

Print Thread
#251218 11/02/15 11:38 PM
S
Sjoepele
Sjoepele
S
Hi,

lets say we have a file with a single line. that single line contains info about the song thats currently playing in a media player with the format "song" - artist.

for example
Code:
“Lay Your Love Down - Single Version” ― Wolf Gang


Lets say i want to extract ONLY the song name (so the part inside the quotations) i'm curious what the best way would be to do so.

myself i've tried to tackle this with $pos to check the position of the second quotation mark, only to find out that special characters (or their $chr versions) aren't supported by $pos
Code:
var %readsong $read(nowplaying.txt)
  var %poschr34 $pos(%readsong, $chr(34))
  set %song $mid(%readsong,2,$calc(%poschr34 - 1))


Also earlier when i used $pos in an earlier question i was advised to not use it.

Its kind of frustrating that this looks so easy, yet i have no answer to it, so help, as always, would be appreciated smile

#251220 12/02/15 12:01 AM
S
Sakana
Sakana
S
Code:
alias test {
  var %song = “Lay Your Love Down - Single Version” ― Wolf Gang
  if $regex(%song,/“(.*?)”/) {
    echo -a $regml(1)
  }
}


wink

Last edited by Sakana; 12/02/15 12:01 AM.
#251221 12/02/15 12:35 AM
S
Sjoepele
Sjoepele
S
Ah, the magical realm of regex smile

thanks a bunch! worked perfectly ^_^


Link Copied to Clipboard