Prev: FAQ 6.13 What does it mean that regexes are greedy? How can I get around it?
Next: FAQ 7.4 How do I skip some return values?
From: Jason Carlton on 8 Mar 2010 22:03 Every once in awhile, someone will copy and paste into my message board from Word. After it submits through my Perl script, I'll have something like this plugged in: Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle- rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso- style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso- padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para- margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left: 0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso- ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font- family:Calibri; mso-hansi-theme-font:minor-latin;} The fonts and all that are different for each post; the only consistency seems to be that it starts with "Normal 0 false false false", and it ends with a "}". Would something as simple as this be enough to consistently remove it? $comment =~ s/Normal 0 false false false.*?}//gsi; Or is there more to it than I'm thinking?
From: Jason Carlton on 9 Mar 2010 20:08 On Mar 8, 10:03 pm, Jason Carlton <jwcarl...(a)gmail.com> wrote: > Every once in awhile, someone will copy and paste into my message > board from Word. After it submits through my Perl script, I'll have > something like this plugged in: > > Normal 0 false false false EN-US X-NONE X-NONE > MicrosoftInternetExplorer4 /* Style Definitions */ > table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle- > rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso- > style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso- > padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para- > margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left: > 0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; > font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso- > ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New > Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font- > family:Calibri; mso-hansi-theme-font:minor-latin;} > > The fonts and all that are different for each post; the only > consistency seems to be that it starts with "Normal 0 false false > false", and it ends with a "}". > > Would something as simple as this be enough to consistently remove it? > > $comment =~ s/Normal 0 false false false.*?}//gsi; > > Or is there more to it than I'm thinking? Sorry if I made that too much to read. Basically, I want to remove "Normal 0 false false false" followed by random stuff, but always ending with }. Will this do it correctly, or will it remove other things that I'm not recognizing? $comment =~ s/Normal 0 false false false.*?}//gsi; TIA, Jason
From: Tad McClellan on 9 Mar 2010 20:30 Jason Carlton <jwcarlton(a)gmail.com> wrote: > Sorry if I made that too much to read. You've shown in the past that anything you write is too much to read. :-( -- Tad McClellan email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/" The above message is a Usenet post. I don't recall having given anyone permission to use it on a Web site.
From: Jason Carlton on 9 Mar 2010 20:53 On Mar 9, 8:30 pm, Tad McClellan <ta...(a)seesig.invalid> wrote: > Jason Carlton <jwcarl...(a)gmail.com> wrote: > > Sorry if I made that too much to read. > > You've shown in the past that anything you write is too much to read. > > :-( > > -- > Tad McClellan > email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/" > The above message is a Usenet post. > I don't recall having given anyone permission to use it on a Web site. So, you're saying that you don't know the answer? If so, then why bother replying? Or spending time in a Perl NG, for that matter.
From: sln on 9 Mar 2010 21:21
On Mon, 8 Mar 2010 19:03:03 -0800 (PST), Jason Carlton <jwcarlton(a)gmail.com> wrote: >Every once in awhile, someone will copy and paste into my message >board from Word. After it submits through my Perl script, I'll have >something like this plugged in: > >Normal 0 false false false EN-US X-NONE X-NONE >MicrosoftInternetExplorer4 /* Style Definitions */ >table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle- >rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso- >style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso- >padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para- >margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left: >0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; >font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso- >ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New >Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font- >family:Calibri; mso-hansi-theme-font:minor-latin;} > >The fonts and all that are different for each post; the only >consistency seems to be that it starts with "Normal 0 false false >false", and it ends with a "}". > >Would something as simple as this be enough to consistently remove it? > >$comment =~ s/Normal 0 false false false.*?}//gsi; > >Or is there more to it than I'm thinking? $comment =~ s/Normal 0 false false false[^{]+\{[^}]+\}//; |