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


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] strip series of numbers and letters after # In reply to
Thanks, Andy!