LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-16-2008, 12:00 PM   #1
TheBeli
LQ Newbie
 
Registered: Feb 2008
Distribution: LFS
Posts: 23

Rep: Reputation: 15
Searching for numeric values in PHP


........remove please

Last edited by TheBeli; 04-16-2008 at 12:48 PM.
 
Old 04-16-2008, 12:19 PM   #2
duryodhan
Senior Member
 
Registered: Oct 2006
Distribution: Slackware 12 Kernel 2.6.24 - probably upgraded by now
Posts: 1,054

Rep: Reputation: 46
http://in2.php.net/manual/en/function.preg-replace.php

should do it.

I think '

$string = 'input text';
$pattern = '/(\w+) (\d)(\d)(\d+)(\w+)/i';
$replacement = '${1}1337$3$4';
echo preg_replace($pattern, $replacement, $string);
 
Old 04-16-2008, 05:40 PM   #3
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
A reverse engineering problem...

We have the answer, but what was the question?
 
Old 04-16-2008, 08:40 PM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,164

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
Since the answer was not '42', the question was not "What is the meaning of life and everything?"

OTOH, maybe there were more answers to that question, and this might be one of them.

jlinkels
 
Old 04-16-2008, 10:02 PM   #5
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Well I believe that there is overwhelming evidence that the answer is 42 but as we know the answer is never as interesting as the question.
 
Old 04-17-2008, 03:55 AM   #6
duryodhan
Senior Member
 
Registered: Oct 2006
Distribution: Slackware 12 Kernel 2.6.24 - probably upgraded by now
Posts: 1,054

Rep: Reputation: 46
iirc

he wanted to replace

<text+><digit><digit><more digits><moretext>
with
<text+><digit><digit>1337<moredigits><more text>

Last edited by duryodhan; 04-17-2008 at 03:58 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH scripting: check for numeric values linuxLuser Programming 11 11-14-2011 10:11 AM
Searching For Someone who can hack Admin panel on PHP! :) skate Linux - Software 3 12-29-2004 09:26 AM
MySQL Returning very strange Values in PHP Script benrose111488 Programming 2 10-21-2004 11:26 AM
PHP HELP: values are deleted from cookies in Mozilla xbaez Programming 0 07-13-2004 11:14 PM
Searching PHP RPM?!?!!?!! djkoe Linux - Newbie 1 12-29-2003 10:03 AM


All times are GMT -5. The time now is 07:22 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration