TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-21-2008, 02:50 AM   #1 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default assigning pcre replacements ( $1 or $2 or whatever ) to variables

I want to know how to do this. How do you take the replacements and assign them to variables?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-21-2008, 03:48 AM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

I'm not sure if this is exactly what you were looking for, but I would do something like this, maybe;

PHP Code:
$szExplode preg_replace("/(first match)(second match)(so on)/""$1|$2|$3"$szString);
$aExplode explode("|"$szExplode); 
And now you have an array full of your matches. If I understood the question right?
-m
delayedinsanity is offline  
Reply With Quote
The Following 2 Users Say Thank You to delayedinsanity For This Useful Post:
Orc (04-21-2008), Rendair (04-21-2008)
Old 04-21-2008, 04:15 AM   #3 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by delayedinsanity View Post
I'm not sure if this is exactly what you were looking for, but I would do something like this, maybe;

PHP Code:
$szExplode preg_replace("/(first match)(second match)(so on)/""$1|$2|$3"$szString);
$aExplode explode("|"$szExplode); 
And now you have an array full of your matches. If I understood the question right?
-m
GAH, so simple a cave man can do it. >.< I'm sorry, but that was too simple, and I'm ranging myself to advanced, I guess I need to press harder into it. -_-
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-21-2008, 04:51 AM   #4 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Sometimes you just have to step back and look at things from a different angle. I'm still really new at this stuff too, and some things that seem almost impossible to do one day, just jump out at me the next and I wonder how come I never saw it before.
-m
delayedinsanity is offline  
Reply With Quote
Old 04-21-2008, 04:53 AM   #5 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by delayedinsanity View Post
Sometimes you just have to step back and look at things from a different angle. I'm still really new at this stuff too, and some things that seem almost impossible to do one day, just jump out at me the next and I wonder how come I never saw it before.
-m
I've been doing php for 1 and half years, so I guess I would be a little rusty sometimes, so oh well. I come from other languages, like C++, Java, and Shell. Thus I seem to quickly understand PHP.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-21-2008, 08:55 AM   #6 (permalink)
The Addict
Upcoming Programmer Top Contributor 
 
Rendair's Avatar
 
Join Date: Nov 2007
Location: UK
Posts: 319
Thanks: 18
Rendair is on a distinguished road
Default

Quote:
Originally Posted by Orc View Post
GAH, so simple a cave man can do it. >.< I'm sorry, but that was too simple, and I'm ranging myself to advanced, I guess I need to press harder into it. -_-
I don't know if its me, but you can come across abit rude to some poeple when they give you their opinions and considering you did not say you wanted advance its hard for people to know lol.
__________________
www.jooney.co.uk - the online portfolio
Send a message via MSN to Rendair
Rendair is offline  
Reply With Quote
Old 04-21-2008, 07:11 PM   #7 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Rendair View Post
I don't know if its me, but you can come across abit rude to some poeple when they give you their opinions and considering you did not say you wanted advance its hard for people to know lol.
Okay. (chars)
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-21-2008, 07:53 PM   #8 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Quote:
I don't know if its me, but you can come across abit rude to some poeple when they give you their opinions and considering you did not say you wanted advance its hard for people to know lol.
I didn't get that at all. I read it like; *bangs head on table* I should've thought of that!

But I dunno, I never know. I've grown used to the fact that nobody can read your body language or hear your tone online and therefore a lot goes misinterpreted. I get accused of being an ass alllllll the time because I'm just very straightforward and have a sadisticly cynical and sarcastic sense of humor. Yes, I am working on making that into a tongue twister.

Anywho.
-m
delayedinsanity is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:32 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design