LinuxQuestions.org
Register a domain and help support LQ
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, 01: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 01:48 PM.
 
Old 04-16-2008, 01: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, 06: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, 09:40 PM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,244

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
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, 11: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, 04: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 04: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 11:11 AM
Searching For Someone who can hack Admin panel on PHP! :) skate Linux - Software 3 12-29-2004 10:26 AM
MySQL Returning very strange Values in PHP Script benrose111488 Programming 2 10-21-2004 12:26 PM
PHP HELP: values are deleted from cookies in Mozilla xbaez Programming 0 07-14-2004 12:14 AM
Searching PHP RPM?!?!!?!! djkoe Linux - Newbie 1 12-29-2003 11:03 AM


All times are GMT -5. The time now is 11:37 PM.

Main Menu
Advertisement
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