Click to See Complete Forum and Search --> : Regular expression


wolfmah
September 19th, 2003, 12:05 AM
I have lots of lines, very lots, and very lots and I would like to translate them into valid URL with regular expression (i.e.: convert space into %20 and so on). The catch is that it's not all the lines that I want to convert, only those that don't start with # sign.

For example : #EXTINF:220
Line that need to be convert (&+*%$)
#The line above should result to this : Line%20that%20need%20to%20be%20convert%20(&%2B*%25%24)

So far, no result have been good. I tried to make it myself and tried to search on the web if it would already exist, but nothing... :(

If you want to help me out, you will be greatly welcomed.

Manish Malik
September 20th, 2003, 08:24 AM
My regex skills are rusty now ... but still a try:

"^#.*" would match a line starting with '#'

"^[^#].*" would match a line not starting with '#'

Something on the above lines..