Jun 24, 2018 - 07:57 AM

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Author Message
severin
Post subject: PHP: in preg_replace weiterzaehlen?  PostPosted: May 17, 2006 - 10:54 AM




Joined: Mar 18, 2004
Posts: 3315

Hallo!
Ich moechte gerne Dateien abspeichern, ohne eventuell vorhandene Dateien zu ueberschreiben. Will heissen: wenn eine Datei Fra2001_1.pdf schon existiert, soll die neu anzulegende Datei automatisch Fra2001_2.pdf genannt werden. Das wollte ich per preg_replace loesen, stehe jetzt nur auf dem Schlauch, wie ich weiterzaehlen lasse. Also so was in der Art
Code:
preg_replace("/(.*\d{4})_(\d)/","$1_$2+1","Fra2001_1");
schwebt mir vor, aber natuerlich klappt das $2+1 nicht: es liefert anstatt "Fra2001_2" "Fra2001_1+1".

Hat jemand nen heissen Tip fuer mich?

Schoene Gruesse,
Severin

_________________
Kein Wort verstanden? Linux-Anfaenger? Auf http://wiki.kanotix.net/CoMa.php?CoMa=LinuxfuerDummies gibt's ein Glossar.

No clue what I'm talking about? New to Linux? Check http://wiki.kanotix.net/CoMa.php?CoMa=LinuxForDummies for a glossary.


Last edited by severin on May 19, 2006 - 11:18 AM; edited 1 time in total
 
 View user's profile Send private message Visit poster's website ICQ Number 
Reply with quote Back to top
schnorrer
Post subject: PHP: in preg_replace weiterzaehlen?  PostPosted: May 18, 2006 - 07:49 PM




Joined: Jan 09, 2006
Posts: 1539

preg_replace("/(.*\d{4})_(\d)/","$1_$2+1"); Deine Zeile

preg_replace("/(.*\d{4})_(\d)/","$1_($2+1)"); Meine zeile
 
 View user's profile Send private message  
Reply with quote Back to top
severin
Post subject: PHP: in preg_replace weiterzaehlen?  PostPosted: May 19, 2006 - 11:23 AM




Joined: Mar 18, 2004
Posts: 3315

liefert "Fra2001_(1+1)"; die Klammern werden anscheinend gar nicht interpretiert. Aber danke fuer die Hilfe!

_________________
Kein Wort verstanden? Linux-Anfaenger? Auf http://wiki.kanotix.net/CoMa.php?CoMa=LinuxfuerDummies gibt's ein Glossar.

No clue what I'm talking about? New to Linux? Check http://wiki.kanotix.net/CoMa.php?CoMa=LinuxForDummies for a glossary.
 
 View user's profile Send private message Visit poster's website ICQ Number 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits
 
RSS All News | English News | Deutsche News | All Forum Topics | English Forum Topics | Deutsche Forum Topics
Logos and trademarks are the property of their respective owners, comments are property of their posters, the rest is © 2004 - 2006 by Jörg Schirottke (Kano).
Consult Impressum and Legal Terms for details. Kanotix is Free Software released under the GNU/GPL license.
This CMS is powered by PostNuke, all themes used at this site are released under the GNU/GPL license. designed and hosted by w3you

Fatal error: Call to a member function Execute() on a non-object in /srv/www/subdomains/archive/includes/pnSession.php on line 378