Gossamer Forum
Home : General : Perl Programming :

strip series of numbers and letters after #

Quote Reply
strip series of numbers and letters after #
I need help with a regex to strip series of numbers and letters follwing # from titles. e.g. #8545 or #8545-AFT etc., these characters can be anywhere in the beginning, end or middle of my title

e.g. "my title is #8545" or "#8545 listed here" or "listed #8545 here" - I want anything following # stripped upto 4,5,6,7 characters.

Title =~ s/

Thanks
Quote Reply
Re: [socrates] strip series of numbers and letters after # In reply to
Hi,

Something like this should do the trick:

Code:
$value =~ s/\#([a-z0-9\-]{4,7})//sig;

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] strip series of numbers and letters after # In reply to
Thanks, Andy!