crackmaster Posted March 5, 2009 Share Posted March 5, 2009 (edited) heh.. i need help again Here is my problem: i can't figure it out how to replace whole line in file, instead of specified string. For example: Winamp playlist contains this lines of text: #EXTINF:428,02 - Void - Fuck The System (Skazi Remix) D:\Qwerty\Void\02 - Void - Fuck The System (Skazi Remix).mp3 #EXTINF:464,02-void - hghway to hell-mycel D:\Qwerty\Void\02-void_-_hghway_to_hell-mycel.mp3 I need 2 delete whole line that begin with "#EXTINF:", so at the end, file will contain only full paths, like this: D:\Qwerty\Void\02 - Void - Fuck The System (Skazi Remix).mp3 D:\Qwerty\Void\02-void_-_hghway_to_hell-mycel.mp3 I have no idea how to work this out, and therefore my example looks like this )) THankS. Edited March 5, 2009 by crackmaster Link to comment Share on other sites More sharing options...
Authenticity Posted March 5, 2009 Share Posted March 5, 2009 It's faster to read the whole file, delete it, modify the text using StringReplace, StringRegExpReplace etc. and write a new file with the modified text. Link to comment Share on other sites More sharing options...
crackmaster Posted March 5, 2009 Author Share Posted March 5, 2009 It's faster to read the whole file, delete it, modify the text using StringReplace, StringRegExpReplace etc. and write a new file with the modified text.Yes, but how? I can replace "#EXTINF:" string, but i need to delete every line that begin with "#EXTINF:". Link to comment Share on other sites More sharing options...
Authenticity Posted March 5, 2009 Share Posted March 5, 2009 (edited) So it's StringRegExpReplace counterpart is match anything that begins with #EXTINF:followed by anything till the end of the line right? lol $sText = StringRegExpReplace($sText, '^#EXTINF:.*', '') Not tested. Edited March 5, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Varian Posted March 5, 2009 Share Posted March 5, 2009 (edited) Or to remove blank lines from output: $sText = FileRead('test.txt') $sText = StringRegExpReplace($sText, "#EXTINF.*[\n\r]", "") msgbox(32, 'String', $sText) Edited March 5, 2009 by Varian Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now