<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<a class="moz-txt-link-freetext" href="http://en.wikipedia.org/wiki/Regular_expression">http://en.wikipedia.org/wiki/Regular_expression</a><br>
<a class="moz-txt-link-freetext" href="http://www.regular-expressions.info/">http://www.regular-expressions.info/</a><br>
<br>
and #regex in irc/freenode<br>
<br>
On 10/22/2010 03:52 PM, Holly Ferree wrote:
<blockquote
cite="mid:AANLkTi=YrbmhhmGAZEcxhMf5AcfkEw6P0oOkmEmWgNYz@mail.gmail.com"
type="cite">Hello All,<br>
<br>
I have figured out how to open a text file and erase and add new
content... I also know how to add content at the end of the file....<br>
<br>
How do I do search and replace?<br>
<br>
This is the default look for the line of code:
<div class="im"><br>
1167-67271: 10/18 6:45p 186MB 111Pts v8.55.4/9.0.2.3642
Tipsword, Georgia SUCCESS <br>
<br>
</div>
This is how I was told to format it (a little more complex than before):<br>
<br>
1167, 67271, 10/18/2010(CONVERT TO DATE FORMAT), 6:45p(CONVERT TO TIME
FORMAT 18:45), 186000000, 111, v8.55.4, 9.0.2, 3642, Tipsword, Georgia,
SUCCESS<br>
<br>
This is the code that I have so far:<br>
<br>
<?php<br>
$myFile = "test.txt";<br>
$fh = fopen($myFile, 'r+') or die("can't open file");<br>
<br>
WHAT CAN I PUT HERE TO REPLACE ALL THE SPACES AND THEN ADD A COMMA WEAR
NEEDED?<br>
<br>
fclose($fh);<br>
<br>
<br>
--------------------<br>
It needs to be a script because it has hundreds of lines and the report
comes in once a day. Any ideas? <br>
<br>
Any help is appreciated,<br>
<br>
Holly Ferree<br>
<br>
(one person I asked suggested using visual basic instead of php by
creating a .vbs or .vba script using Regular Expressions (Regex) (mix
of find and replace strings like \s+ .... any help on what experssions
to use would be great) and then using an action in outlook 2007 to run
the script when the subject name of Connect Report with the connect.txt
attached is recieved)<br>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
consulting mailing list
<a class="moz-txt-link-abbreviated" href="mailto:consulting@drupal.org">consulting@drupal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.drupal.org/mailman/listinfo/consulting">http://lists.drupal.org/mailman/listinfo/consulting</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Aaron Winborn
Advomatic, LLC
<a class="moz-txt-link-freetext" href="http://advomatic.com/">http://advomatic.com/</a>
Drupal Multimedia available in September!
<a class="moz-txt-link-freetext" href="http://www.packtpub.com/create-multimedia-website-with-drupal/book">http://www.packtpub.com/create-multimedia-website-with-drupal/book</a>
My blog:
<a class="moz-txt-link-freetext" href="http://aaronwinborn.com/">http://aaronwinborn.com/</a></pre>
</body>
</html>