Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

regex halp

Name: Anonymous 2009-01-17 0:49

Hey /prog/,
I'm trying to make a regex to grab file paths out of the txt file itunes gives as a playlist but I keep getting crap mixed in. What am I doing wrong?

(\s+)C:\\Files\\Music(.*\.\w{3})\n
Translation: More than one whitespace, file path, any number of non-newlines, a period, any 3 alphabet characters (the file extension), and a newline.

Name: Anonymous 2009-01-17 1:09

You're using Windows.

Name: Anonymous 2009-01-17 1:11

Your end of line should have some cash monies.

Name: Anonymous 2009-01-17 1:23

\s+C:\\Files\\Music\\(.*?)\r\n
this really belongs in /g/.

Name: Anonymous 2009-01-17 1:55

>>4
No matches with the carriage return.
\s+C:\\Files\\Music((.+)\.(\w{3}))\n
What's the '?' for? Isn't it for +/- a single character?

Changed * to + because there needs to be at least 1 char.
\s+C:\\Files\\Music((.+)\.(\w{3}))\n

Name: Anonymous 2009-01-17 2:02

No matches with the carriage return.
what operating system uses "\" as a path separator and has DOS "C:" faggotry and doesn't use "\r\n" for the ends of lines?
What's the '?' for? Isn't it for +/- a single character?
*? = non-greedy *

\s+C:\\Files\\Music((.+)\.(\w{3}))\n
some_file.flac
OH SHI-

Name: Anonymous 2009-01-17 2:13

>>6
>what operating system uses "\" as a path separator and has DOS "C:" faggotry and doesn't use "\r\n" for the ends of lines?
I guess itunes is kind enough not to add any \r to the playlists it makes. But yea, it does make it a pain. What's worse is I'm going to write a batch file to copy all those files to a single location next.

>some_file.flac
>OH SHI-
Haha, wish itunes could support flac.

Name: Anonymous 2009-01-17 2:20

>>7
why not use a media player that doesn't suck ass? then you can just put the pathnames of your files in a text file one per line and play it like this:
mplayer playlist.txt

and you could copy them all to a single location like this:
for i in $(cat playlist.txt); cp $i /path/to/directory/you/want/to/put/the/files/in

Name: Anonymous 2009-01-17 2:33

>>8
The playlist is from itunes and holds all of the meta tag info, mixed in with the file paths. I am trying to make a playlist as you describe so I can copy my music from windows (itunes) to linux (audacious).

Name: Anonymous 2009-01-17 2:47

Figured it out, was supposed to be using $1 instead of $_, nothing to do with the regex lol. Thanks.

Name: Anonymous 2009-01-17 6:26

Name: Anonymous 2010-12-17 1:35

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Don't change these.
Name: Email:
Entire Thread Thread List