
XeJingle
New User
Dec 7, 2007, 9:49 AM
Post #5 of 6
(3943 views)
|
|
Re: [winfinit] multiple repeating patterns
[In reply to]
|
Can't Post
|
|
well, if i understand correctly, then this should do it #!/usr/bin/perl $OriginalFile = 'ChangeThisToYourFileName'; $ProcessedFile= $OriginalFile .'.PROCESSED'; open (RAWFILE, "$OriginalFile"); open (NEWFILE, "> $ProcessedFile"); while (<RAWFILE>) { if(/^[\s]?\*/) { $_ =~ s|^[\s]?\*(.*)|<li>$1</li>|; } print NEWFILE; } No, that is not that. There is no "<ul>" & "</ul>" in your code. RegExp should replace one or more lines beginning with "^\*\s+" with <ul><li>....</li></ul>. Example : * text 1 * text 2 onetowthree * text 3 * text 4 * text 5 should be: <ul> <li>text 1</li> <li>text 2</li> </ul> onetowthree <ul> <li>text 3</li> <li>text 4</li> <li>text 5</li> </ul> Thanks.
|