|
|
once upon a time i was the queen of sed i was nearly a master of regex in perl.
However i was never able to translate that ability into coldfusion regular
expressions. I can't explain it.
However, that puts me in a spot when i have to format large blocks of text.
So i have two problems:
1) I didn't do TOO badly, however i cannot add to the following an apostrophe
for the life of me...therefore my regex stops when it encounters a '
(code sample for this regex attached)
Here is the text for the first code sample
"Assessment Grant
$200,000 for hazardous substances
MyOrg has selected the City of Metropolis for a silly assessment grant.
Hazardous substances grant funds will be used to conduct about nine Phase I and
five Phase II environmental site assessments in the city's Empowerment Zone.
Grant funds also will be used to support community outreach activities."
2) i'm stumped at how to translate a line that begins with * (or possibly tab
star) into a valid unordered list. Any suggestions?
(There is no code sample for this question)
Text for second code sample:
"The Pilot has:
* Conducted seven discussion sessions between property owners, tenants,
Metropolis City, Myagency, and the responsible party. The purpose of these
meetings was to discuss the integration of the assessment and cleanup with
future land use and redevelopment plans.
The Pilot is:
* Assisting property owners in assessing the affects of various
remediation plans and development options on property values; and
* Developing an Agreement in Principle between the property owners, the
City and the responsible party, which will summarize individual contributions
to support the integration of assessment and cleanup with redevelopment.
Leveraging Other Activities
Experience with the Metropolis Pilot has been a catalyst for related
activities including the following.
* Presenting land use plans to the City Council for review and public
input which will demonstrate how brownfields assessment and cleanup fits into
transportation system plans.
* Documenting the agency process in order to demonstrate successful
strategies that can be used by other communities."
Code sample 1
<!--- regular expression to format the text--->
<cfscript>
awardBlurb = fs_award_text;
//Replace Special Characters
// Grant Type headings - look for any combination of letters
and spaces
followed by "Grant" then a newLine character
//awardBlurb = REReplace(awardBlurb, '([a-zA-Z ]+Grant)',
'<h4>\1</h4>',
'all');
awardBlurb = REReplace(awardBlurb, '([a-zA-Z ]+Grant+[s])',
'<h4>\1</h4><p>', 'all');
// Award amount lines - look for a dollar sign followed by any
combination
of characters then a newLine character
awardBlurb = REReplace(awardBlurb, "(\$[A-Za-z0-9, ]+.)",
"<em>\1</em><br/>", "all");
// Award blurb text - look for the phrase "... has selected"
followed by a
string of alpha-numeric characters and standard punctuation
awardBlurb = REReplace(awardBlurb, "(MyOrg has
selected[a-zA-Z0-9&@##
.;:!?,-]+)", '</p><p>\1</p>', 'all');
</cfscript>
#awardBlurb#
|
|