Author Topic: How do you extract just the filename..  (Read 4156 times)

MorpheusDreamlord

  • Jr. Member
  • **
  • Posts: 74
    • ICQ Messenger -
    • AOL Instant Messenger -
    • Yahoo Instant Messenger -
    • View Profile
    • Email
How do you extract just the filename..
« on: September 01, 2002, 08:54:57 AM »
Using this embeded midi filter

Name = "Embed BGsound Link Sept 0102"
Active = TRUE
URL = "$TYPE(htm)"
Bounds = "$NEST(<object,</object>)|<(embed|bgsound)s*>"
Limit = 1024
Match = "*ssrc=("*'|w)1*&*.(mid|midi|mp3|wav|wmx|wma)2"
Replace = "<a class="sound" class="proxlink" href=1>[2 - 1]</a>"

you get "mid - <full internet url/site/path>/jupo.mid"

how do I alter the filter to just have "mid - jupo.mid"
shown??

|
Come to the Dreaming...
|
Come to the Dreaming...

TEggHead

  • Jr. Member
  • **
  • Posts: 93
    • ICQ Messenger - 21893433
    • AOL Instant Messenger -
    • Yahoo Instant Messenger - eljarec
    • View Profile
    • Email
How do you extract just the filename..
« Reply #1 on: September 01, 2002, 10:45:49 AM »
Hi,

Try this
Match = "ssrc=("*'|w)*&([a-z]+://|)([^/]++/|)+1.(mid|midi|mp3|wav|wmx|wma)2"

if you change the match like this, it will pick up just the last part after any present / (reasoning if it is not present you already have just the filename)

small explanation for those not seeing it yet

([a-z]+://|) consumes any prsent protocol up to the beginning of the hostname
([^/]++/|)+ hops from slash to slash until any present path level is consumed,

the remainder can then only be the filename...

HTH

 
 

MorpheusDreamlord

  • Jr. Member
  • **
  • Posts: 74
    • ICQ Messenger -
    • AOL Instant Messenger -
    • Yahoo Instant Messenger -
    • View Profile
    • Email
How do you extract just the filename..
« Reply #2 on: September 01, 2002, 01:53:38 PM »
TEggHead thanks, it seems to be ok in theory, but in practice the midi slips
through the filter now.

This is the site I'm using to test it (Christmas midi embeded)
http://www.auburn.edu/~vestmon/christmas.html

with the old filter, it shows the prox.css link mid - <full path><name>.mid
with the new one it shows the embeded player..

|
Come to the Dreaming...
|
Come to the Dreaming...

sidki3003

  • Sr. Member
  • ****
  • Posts: 476
    • ICQ Messenger -
    • AOL Instant Messenger -
    • Yahoo Instant Messenger -
    • View Profile
    • http://
    • Email
How do you extract just the filename..
« Reply #3 on: September 01, 2002, 02:50:21 PM »
How about this one?

[Patterns]
Name = "<embed>...: Embed or BGsound to Link"
Active = TRUE
URL = "$TYPE(htm)"
Bounds = "<(bgsounds*>|object*</object>|embed*>(*</embed>|))"
Limit = 1024
Match = "*src=$AV((([^/]++/|)+(*.(mid|midi|wav|mp3|wmx|wma)2)3)1)*"
Replace = "<a class="sound" title="3" href="1">[2]</a>"

or

Match = "*src=$AV((([^/]++/|)+(*.(mid|midi|wav|mp3|wmx|wma))2)1)*"
Replace = "<a class="sound" href="1">[2]</a>"

edit: added two missing parens in the 2nd version

Edited by - sidki3003 on 01 Sep 2002  18:52:55
 

altosax

  • Sr. Member
  • ****
  • Posts: 328
    • ICQ Messenger -
    • AOL Instant Messenger -
    • Yahoo Instant Messenger -
    • View Profile
    • http://
    • Email
How do you extract just the filename..
« Reply #4 on: September 01, 2002, 03:34:38 PM »
has someone tryed using d, h, p and so on?

altosax.

 
 

MorpheusDreamlord

  • Jr. Member
  • **
  • Posts: 74
    • ICQ Messenger -
    • AOL Instant Messenger -
    • Yahoo Instant Messenger -
    • View Profile
    • Email
How do you extract just the filename..
« Reply #5 on: September 01, 2002, 04:26:55 PM »
Sidki!!!! YESSSSSSSS!!!

That last section did it - the filter still kills embed sounds, AND shows the file name, just in case you MIGHT like it....

Thanks mate - I'll owe you two beers now, when you come to Aussieland..

|
Come to the Dreaming...
|
Come to the Dreaming...

sidki3003

  • Sr. Member
  • ****
  • Posts: 476
    • ICQ Messenger -
    • AOL Instant Messenger -
    • Yahoo Instant Messenger -
    • View Profile
    • http://
    • Email
How do you extract just the filename..
« Reply #6 on: September 01, 2002, 04:36:06 PM »