search -  faq -  rulez -  staff

forums






map cycle
irc              pwnalizer
voice         dswp bar




Register

Login


It is currently 04.20.24

 

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: PHP regep help pls :)
PostPosted: 11.08.09 
Offline
Godlike
User avatar

Joined: 01.19.09
Posts: 1134
need some help with a regular expression

I need to filter text for something like:
tabel 2.1
So it needs to catch that entire piece of text (actually where the word 'table' starts and ends I guess) AND then I want the number (2.1) stored seperately in a variable so I can access it.

help? :D

_________________
the meaning of the word cunt....loool

Image



 


Top
 Profile  
 
PostPosted: 11.08.09 
Offline
Godlike
User avatar

Joined: 01.19.09
Posts: 1134
thanks for the help cunts

figured it out :)

Code:
$haystack = 'voor een gebruiksfunctie in tabel 2.5 voorschriften zijn'; //example text
$match = '#b(tabel)(s{1})([0-9.]{1,})#'; //(first match the word 'tabel') (second match a single whitespace character) (third match a word which consists of numbers and dots only) -->matches stored in variables ordered in the sequence they are indexed/ started
$replace = "<a href="#" onClick="javascriptwinBRopen('view/table/?tabel_nr=$3', '', 800, 600, 0, 0, 0, 0)">$1$2$3</a>";
return preg_replace($match, $replace, $haystack);
 

_________________
the meaning of the word cunt....loool

Image



 


Top
 Profile  
 
PostPosted: 11.09.09 
Offline
Godlike
User avatar

Joined: 07.15.08
Posts: 4645
Location: Behind U
-----tdm:  
nick: [dswp]GewitterOma
skill: 1122.83
kills: 25960
deaths: 19847
ratio: 1.30
-----bomb:  
nick: [dswp]GewitterOma
skill: 812.172
kills: 3885
deaths: 3541
ratio: 1.09
:)

_________________
Image



 


Top
 Profile  
 
PostPosted: 11.09.09 
Offline
Leader
User avatar

Joined: 11.29.08
Posts: 1972
Wow you still found time to get the regex working despite 10 hours spent on the server slicing people ? tdm-player58793 - gg ;)

_________________
ut4_he_tennis_v0.1
-------------------------
"We are talking about computers here, compared to those I can read women like a book ;P"
Unclefragger



 


Top
 Profile  
 
PostPosted: 11.13.09 
Offline
Godlike
User avatar

Joined: 01.19.09
Posts: 1134
SvaRoX wrote:
Wow you still found time to get the regex working despite 10 hours spent on the server slicing people ? tdm-player58793 - gg ;)


ahah, I was mostly in spectator :D

love coding :D
and frigging love ajax in combination with PHP...powerrrrrrrrrrrrr

_________________
the meaning of the word cunt....loool

Image



 


Top
 Profile  
 
PostPosted: 12.17.09 
Offline
Godlike
User avatar

Joined: 07.20.08
Posts: 369
Location: Switzerland
I know this is an old topic, just stumbled upon it. Your RegEx is a little weird and the "." actually matches anything (not just a literal dot), so I bet that it does not work on the following string:

"this tabel is tabel 3.2"

You can simply use:

Code:
#b(tabel)s+(&#91;d.&#93;+)#


:)

_________________
There is no god.



 


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Imprint

Powered by phpBB © 2000, 2002, 2005, 2007, 2008, 2009, 2010 phpBB Group

Skin by Lucas Kane
we use apache2 mod rewrite with phpBB SEO
map train_beta1-100 © 2009 by SteveMcQueen
Statistics Backend + Database by XLR Stats and B3 Bot
mapvote robot and gameserver monitor © 2009 by BlinKy
mumble viewer Copyright © 2008 Dominik Radner (aka Urmel)
mumble switcher and integration © 2008 by XTJ7, Unclefragger and Wursti
Localisation Plugin © 2009, Team Leads Plugin © 2009 and Knifer Plugin © 2009 by SvaRoX
for our stats we use Chart.js Copyright (c) 2013-2015 Nick Downie.
the stats also use some jQuery jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc.



voice server
top 20 players


nameskillkills
-Dws.BLINGBLING*-*1730.63418631
NormaSnockers1865.75400492
Zottel1760.8276378
make.them.suffer1846.17269872
>8v=1825.35230156
moon1777.56195615
sjas1692.49192315
peace1878.86190660
Wagner_Moura1562.9188001
Goomba1859.75182677
z0rn1608.41181016
Mad1803.76179124
[dswp]PLZ1847.85178516
Graf_ZahlIII1835.73167407
Zohan1611.07159737
ubercunt1634.93159240
Yarrr!1917.33156233
I_am_nOOb1909.64151268
Pandageddon1891.75148319
Pirat1664.08145798