May 24, 2012, 05:32:27 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: Mobile users - Our forum is Tapatalk enabled.
http://www.tapatalk.com/
Home
Help
Search
Login
Register
DotDragnet
>
The Tech Side
>
Tech stuff
>
numbers regex
Pages: [
1
]
Go Down
« previous
next »
Print
Author
Topic: numbers regex (Read 219 times)
Charisma Bypass
Hero Member
Posts: 556
numbers regex
«
on:
July 15, 2011, 06:53:27 PM »
Is there a nice and easy regex I can use to strip the numbers off the *end* of a string?
Eg;
W1NPPP34
would become W1NPPP
Been hunting google and only come across convoluted methods. Easy to strip out all the numbers of course, but that doesn't fit the need
Thanks in advance
Logged
JasonD
Global Moderator
Hero Member
Posts: 551
Re: numbers regex
«
Reply #1 on:
July 15, 2011, 08:04:10 PM »
Code:
rtrim($foo, '0..9')
Or \d+$ for a regex
Logged
Charisma Bypass
Hero Member
Posts: 556
Re: numbers regex
«
Reply #2 on:
July 17, 2011, 11:25:01 AM »
I never knew rtrim could do that. Thank you very much Jason.
Logged
Pages: [
1
]
Go Up
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> General Discussion
=> Jee's Forum of Appalling Jokes
-----------------------------
The Creative Side
-----------------------------
=> Arty stuff
=> Photography
=> On the web
-----------------------------
The Tech Side
-----------------------------
=> Tech stuff
=> Hardware & Software
-----------------------------
The Business Side
-----------------------------
=> Anything business related
-----------------------------
The Practical Side
-----------------------------
=> Practical Advice
DotDragnet
>
The Tech Side
>
Tech stuff
>
numbers regex
Loading...