>Hi,
>
>I'm using cffile to read a .txt file.
>I need to Replace the Carriage Return Line feed with a '|' when the new line
>begins with a '0' or a '1'
>and a '*' when the new line begins with a '"'.
>
>I am just too unfamiliar with RegEx to do it.
>
>Any Ideas?
>
>David DiPietro
>OSU College of Medicine

Given that your text file contents are in a variable called fileContent, you can use a 
pair of regexes to do it:

<cfset fileContent = REReplace( fileContent, "\n([01])", "|\1", "all" ) />
<cfset fileContent = REReplace( fileContent, "\n("")", "*\1", "all" ) />

The first regex does the | characters. It searches for a line break (the \n) followed 
by either a 0 or 1. It replaces it with a pipe and whatever numeral was matched. The 
secpond regex uses the same technique to do the asterisks.

Not sure if those can be combined into a single regex.

Good luck!

Mike Mertsock
Alfred University Web Team
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to