473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Pulling a specific string from a file

Hi, I'm looking at pulling a string from a source file and am wondering the
best way to do this. I have a starter and ender quote but am just wondering
the best way to do this? Regular expressions?

Thanks
Dec 7 '05 #1
2 1330
elyob wrote:
Hi, I'm looking at pulling a string from a source file and am wondering
the best way to do this. I have a starter and ender quote but am just
wondering the best way to do this? Regular expressions?

Thanks


Easiest way without regexpr is using:
substr()
and
strpos()

Use strpos to find the position of the starterquote and also for endquote.
Use substr to retrieve the part inbetween.

check at www.php.net for usage.
It is really very straightforward (when you know the functionnames. :P )

Regards,
Erwin Moller
Dec 7 '05 #2

"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:43***********************@news.xs4all.nl...
elyob wrote:
Hi, I'm looking at pulling a string from a source file and am wondering
the best way to do this. I have a starter and ender quote but am just
wondering the best way to do this? Regular expressions?

Thanks


Easiest way without regexpr is using:
substr()
and
strpos()

Use strpos to find the position of the starterquote and also for endquote.
Use substr to retrieve the part inbetween.

check at www.php.net for usage.
It is really very straightforward (when you know the functionnames. :P )


Thanks, I just thought I'd try that before you posted, I've now got the
string out succesfully! The strstr function was also very useful.

Thanks
Dec 7 '05 #3

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

Similar topics

2
by: PuckInLA | last post by:
I have a question. I have some data that I am pulling into a dataset that needs to have each row of data emailed out. I got the email funciton working great but its extracting that data that is...
4
by: washoetech | last post by:
Hello, I am working on a project where I need to be able to grab the data from an Excel spreadsheet and create a new table in my database based on the columns in the spreadsheet. After the...
1
by: Usarian Skiff | last post by:
I'm pulling a list of data from an excel file. When I open Excel files directly, if someone else has it open, I can select 'READ-ONLY' from a pop-up. When accessing the file from within my...
5
by: akelly_image | last post by:
Okay, if anyone could toss me some idea's here, please bare with my noobish questions, I just picked up VB2005 Pro about a week ago. ( no prior VB at all ) Here's my issue.. I'm pulling...
7
by: danielbaars | last post by:
Hello, I'm almost a complete newbie to using PHP and I was hoping one of you guys can point me in the right direction. I'm working on a site for a brand of handmade fruit juice and it only needs...
2
by: foenotes | last post by:
hi i have a sentance in a .txt file and would like to pull it out from the txt file and assign it to a cstring. so the user only has to edit the txt file to change the sentance. how do i do...
1
by: Ron | last post by:
Hello, I am looking for some way to loop through a spreadsheet and look for a specific word in a rows cell and then take all rows that have that word, take the entire row and put them into their...
3
by: Donkeyoz | last post by:
Hi all, Trying to do something fairly basic but am getting caught up on it. I am trying to extract text from a .txt file into an array line by line and then dissect that line into various parts,...
12
by: Alexnb | last post by:
This is similar to my last post, but a little different. Here is what I would like to do. Lets say I have a text file. The contents look like this, only there is A LOT of the same thing. () A...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...

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.