Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Perl Replace Help

by l3nz (Friar)
on Dec 04, 2003 at 09:01 UTC ( [id://312146]=note: print w/replies, xml ) Need Help??


in reply to Perl Replace Help

This is quick and dirty, but it should do. At least it does in the test case. Whether it's hand-edited or machine-generated, I think it's safe to assume that we have no CR within a given formatting statement and each and every reference to 'Arial' will be in the context of font formatting (you are not usin this on a tipographer's site, right?)

This is the code:

use strict; while (<DATA>) { s/font-size:\s*10pt/font-size: 18pt/i; s/Times New Roman/Helvetica/i; print $_; } __DATA__ body { text-decoration: none; text-indent: 0in; text-align: left; lang: en-US; font-weight: normal; font-variant: normal; color: #000000; font-size: 10pt; font-style: normal; widows: 2; font-family: 'Times New Roman'; } <p dir="ltr" style="text-align: justify"><span style="font-weight: +bold; lang: en-US; font-size: 11pt; font-family: 'Arial'">Consultancy +</span></p>
This prints out:
body { text-decoration: none; text-indent: 0in; text-align: left; lang: en-US; font-weight: normal; font-variant: normal; color: #000000; font-size: 18pt; font-style: normal; widows: 2; font-family: 'Helvetica'; } <p dir="ltr" style="text-align: justify"><span style="font-weight: +bold; lang : en-US; font-size: 11pt; font-family: 'Arial'">Consultancy</span></p>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://312146]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-24 03:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found