473,804 Members | 3,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

$alines = preg_split("/=/", $lines);

is there any thing we can write to keep the right txt to the = sign in
the preg_split. from the following lines

DST-NUMBER-IN=003351287759 6, DST-NUMBER-OUT=98751#33512 877596,
DST-NUMBER-BILL=0033512877 596

i only want 0033512877596, 98751#335128775 96, 0033512877596

Aug 29 '05 #1
15 2164
On Sun, 28 Aug 2005 17:54:52 -0700, voipcanada wrote:
is there any thing we can write to keep the right txt to the = sign in
the preg_split. from the following lines

DST-NUMBER-IN=003351287759 6, DST-NUMBER-OUT=98751#33512 877596,
DST-NUMBER-BILL=0033512877 596

i only want 0033512877596, 98751#335128775 96, 0033512877596


I believe that already answered this. What do you mean by "keep the right
txt to the = sign"?

--
http://www.mgogala.com

Aug 29 '05 #2
no one answered this till now, i need to know the exact code to be
written ,, kind regards

Aug 29 '05 #3

You could use preg_replace() instead:
Code:
--------------------

$alines = preg_replace("/[^=]+=/", "", $lines);

--------------------
--
macbri
------------------------------------------------------------------------
macbri's Profile: http://www.macosx.com/forums/member.php?userid=34415
View this thread: http://www.macosx.com/forums/showthread.php?t=242019
macosx.com - The Answer to Mac Support - http://www.macosx.com

Aug 29 '05 #4
On Sun, 28 Aug 2005 18:13:58 -0700, voipcanada wrote:
no one answered this till now, i need to know the exact code to be
written ,, kind regards


Look at your previous post and my response.

--
http://www.mgogala.com

Aug 29 '05 #5
Dear Macbri

it does work good but not when we want a file like this to be edited
,,,, please look at the file and if you can suggest some thing
http://starkom.com/bill20050820_000000 .. thanks and regards

Aug 29 '05 #6
On Sun, 28 Aug 2005 18:24:19 -0700, voipcanada wrote:
Dear Macbri


Plonk.

--
http://www.mgogala.com

Aug 29 '05 #7
dear Mladen Gogala

i tryed your suggestions but it does not work ,,,, i need to replace
the in the file above ,, thanks

Aug 29 '05 #8

voipcanada Wrote:
Dear Macbri

it does work good but not when we want a file like this to be edited
,,,, please look at the file and if you can suggest some thing
http://starkom.com/bill20050820_000000 .. thanks and regards

Why not split each line with preg_split() and then use the
preg_replace() as described....?
Code:
--------------------
foreach ($lines as $each) {
$line = preg_split("/,/", $each);
$line = preg_replace ... (etc.)
}
--------------------
--
macbri
------------------------------------------------------------------------
macbri's Profile: http://www.macosx.com/forums/member.php?userid=34415
View this thread: http://www.macosx.com/forums/showthread.php?t=242019
macosx.com - The Answer to Mac Support - http://www.macosx.com

Aug 29 '05 #9
Instead of using preg_split why not trying to reading and writing file

try out this

//Suppose Your file is bill20050820_00 0000.txt
$file = "bill20050820_0 00000.txt";
$fp = fopen($file,'r' );
$string = fread($fp, filesize($file) );
fclose($fp);
//Array of special charecters you want to replace
$special =
array('DST-NUMBER-IN=','DST-NUMBER-OUT=','DST-NUMBER-BILL=');
$replacements = "";

$string = str_replace($sp ecial,$replacem ents,$string);
//Write back to file
$fp = fopen($file,'w' );
fwrite($fp, $string);
fclose($fp);

+++++++++++++++ ++
if you find it useful plz notify me
KERUL
[ProDesignZ]

Aug 29 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6956
by: lecichy | last post by:
Hello Heres the situation: I got a file with lines like: name:second_name:somenumber:otherinfo etc with different values between colons ( just like passwd file) What I want is to extract some part of it like all names or numbers from each line, simply text fom between e.g. second and third colon. And turn it
3
1898
by: tdl | last post by:
Hi everybody, I'm a regular expressions newbie; I read many tutorials, but need more experience before becoming indipendent in this field. I need a little help from you. How can I split such a formatted string: UPPERCASEID0: texttexttexttext UPPERCASEID1: textagaintextagain textagaintextagain UPPERCASEID2: textagaintextagain
5
1893
by: Shmuel | last post by:
Hi, I have problems in trying to '++' an array value. Every time I find a city I add it in the array, and if I find it many times I increment the value (counter) of the city. Here's the code: $address = "http://www.cji.co.il/bw040609.txt"; $address_local = "bw040609.txt"; $lines = file($address_local);
5
2381
by: K | last post by:
I have found a script online that I want to use (I am new to PHP). It creates dynamic images based on the text that you pass it. However, no matter how I try, I can't get anything other than a blank white image. Can one of you knowledgeable people please have a look at the code below and help please.
4
1724
by: tgiles | last post by:
Hi, all. Been staring at this for a couple of hours now and I find myself completely bewildered. I suppose it doesn't help that I'm a php newbie. Nevertheless, I throw myself at your mercy. I have an array which I am attempting to split off into a new array. The first array is just a whole bunch of links like so: http://www.example.com/query?track=http://www.somewhereelse.com/whatever.php
1
1443
by: Brian | last post by:
Hi all Below is a bit of code that opens up and reads a zip file. I'm having trouble working out how to read in line by line. The file I am unzipping is a CSV file and I need to return each line so I can work on them Any help would be great
5
7370
by: Pseudonyme | last post by:
Dear All : Ever had an httpd error_log bigger than the httpd access log ? We are using Linux-Apache-Fedora-Httpd 2006 configuration. The PHP lines code that lead too tons of errors are : $http_ref= $HTTP_REFERER; $prog = $_COOKIE;
4
1378
by: sskk | last post by:
how can i split by blank lines? split(\r\n\r\n,$arr) like this?
14
4535
by: pascalito | last post by:
Hi, i have a problem with a regular expression. i want to split a string on character pipe | with preg_split php function. The string is : "foo|bar|'hello|world\'abc\'def'|bye"
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.