hi all,
i really cannot find a simple exmaple for preg_match function
i whiled the files in the directory ...
$d = dir('.') or die($php_errormsg);
while (false !== ($f = $d->read())) {
if (is_file($d->path.'/'.$f)) {
if (preg_match(match????,substr($f,3))) {
// print '<option> ' . $f . '<option>';
echo "$f\n";
}
}
}
$d->close();
i want to include files begining with "tn_"
what in the heck must stand in pattern position, i tried everything ,
nothing worked
i have actually 8 files starting with tn_* of course ...
thanks 5 1096
"g0c" <RE*******@msn.com> wrote in message
news:dl***********@fegnews.vip.hr... hi all, i really cannot find a simple exmaple for preg_match function
i whiled the files in the directory ...
$d = dir('.') or die($php_errormsg); while (false !== ($f = $d->read())) { if (is_file($d->path.'/'.$f)) { if (preg_match(match????,substr($f,3))) { // print '<option> ' . $f . '<option>'; echo "$f\n"; } } } $d->close();
i want to include files begining with "tn_" what in the heck must stand in pattern position, i tried everything , nothing worked i have actually 8 files starting with tn_* of course ...
thanks
solved : thanks ... /me stupid
/tn.+/ is the solution
g0c wrote: i want to include files begining with "tn_"
if (substr($fname, 0, 3) == 'tn_')
--
E. Dronkert
g0c schrieb: if (preg_match(match????,substr($f,3))) {
Use preg_match("/^tn_.*/",$f);
Or even better, don't use preg_match for this easy case because the
suggested substr-only solution is significantly faster.
OLLi
On Mon, 14 Nov 2005 16:18:02 +0100, g0c wrote: i want to include files begining with "tn_" what in the heck must stand in pattern position, i tried everything , nothing worked i have actually 8 files starting with tn_* of course ...
$files=glob('./tn_*');
foreach ($files as $f) {
print "$f\n";
}
If you kill yourself, may I have your stereo?
-- http://www.mgogala.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Morten Gulbrandsen |
last post by:
Hi Programmers,
after this legal statement
ALTER TABLE EMPLOYEE TYPE =3D InnoDB;
I get=20
Warnings: 0 =20
and still MySQL claims to have to use Type =3D MyISAM,
|
by: Greg McClure |
last post by:
Life is not good.
So I've got a machine that I do some development work on, nothing
major, but I'd like to keep some things intact. I'm running SQL Server
7, it's an old installation, but it...
|
by: Bucko |
last post by:
Hi guys,
I have an app that, right now, uses a SQL Server database and very
simple, universal SQL commands. I use SqlCommand, SqlDataReader and
SqlDataAdapter objects. I use web.config to...
|
by: Dino Buljubasic |
last post by:
Hi,
My application is extensivelly querying a remote server. Somebody
sniffing the traffic could eventually find out all important
information such as passwords (from users in datatables as...
|
by: K B |
last post by:
Hi,
I've just started using Visual Studio 2005 but I do NOT want to use
SqlExpress but my existing sql server database. I've searched and did
the following: ran the aspnet_regsql.exe to update...
| |
by: SAL |
last post by:
Hello,
I am working with Framework 1.1 and Microsoft Enterprise Library 2005. I've
used the Enterprise Library Configuration utility to create my app.config &
dataConfiguration.config files.
...
|
by: fjm |
last post by:
I would like to move several sql statements outside of my php script but have yet to be successful.
I moved the sql to a different location/directory then tried to call the sql with an include...
|
by: kkshansid |
last post by:
i cannot export my sql server database to msaccess database which i usually did successfully 3weeks ago pls help me to find the error
so that i can correct it in future
error is
- Validating...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: 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,...
| |
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |