473,670 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i will kill my(sql) self ! :-)

g0c
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_errorm sg);
while (false !== ($f = $d->read())) {
if (is_file($d->path.'/'.$f)) {
if (preg_match(mat ch????,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
Nov 22 '05 #1
5 1100
g0c
"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_errorm sg);
while (false !== ($f = $d->read())) {
if (is_file($d->path.'/'.$f)) {
if (preg_match(mat ch????,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
Nov 22 '05 #2
g0c wrote:
i want to include files begining with "tn_"


if (substr($fname, 0, 3) == 'tn_')

--
E. Dronkert
Nov 22 '05 #3
g0c schrieb:
if (preg_match(mat ch????,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
Nov 22 '05 #4
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

Nov 22 '05 #5
On Tue, 15 Nov 2005 01:46:25 +0100, Oliver Grätz wrote:
Use preg_match("/^tn_.*/",$f);


There is "glob" function borrowed from the older brother.

http://us2.php.net/manual/en/function.glob.php

--
http://www.mgogala.com

Nov 22 '05 #6

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

Similar topics

0
650
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,
3
1730
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 works and I've got a number of databases on it. So I see the new 2005 Express downloads and I download the Web Developer edition, install it, it installs 2005, but my SQL Server 7 installation now seems to be hosed.
1
1046
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 store my database connection string. I want to make this MS-Access compatible. Please let me know if this is correct and all that is needed to make my software work with Access:
2
1083
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 sell as the password and user name used in connectiong string to that server. How can I protect my self from this? Thank you
2
1063
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 my database for 2.0, that appeared to add tables, etc. I've changed the connection string to point to my db using the LocalSqlServer connection string in webconfig. But even without the connection string, when I simply try to use Tools -...
2
3174
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. My question is, why is the Enterprise Library stripping out my User Id and Password from my SQL Server connection string, that I have in the dataConfiguration file? This is an internal app that has no UI and is an automated process that runs...
2
1095
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 tag within the php but it doesn't work. The reason I want to move the sql away from the php script is to make it more readable. My sql view is ove 20 lines. I also need to add about 5 more views into this php script. Thanks. Frank
0
2888
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 (Error) Messages * Error 0xc02020f6: Data Flow Task: Column "Project ID" cannot convert between unicode and non-unicode string data types. (SQL Server Import and Export Wizard)
0
8386
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
8815
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...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6216
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
5686
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
4213
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
4393
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2044
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.