Gossamer Forum
Home : General : Perl Programming :

Regex split on ampersand & comma

Quote Reply
Regex split on ampersand & comma
I need to truncate a title field from Links SQL to all the text preceding the first ampersand (&) or (,). Does anybody know the regex expression for such a feat? Regex looks really intimidating but I know it can be done.
Quote Reply
Re: [scorpioncapital] Regex split on ampersand & comma In reply to
Maybe something like;

$var =~ m,(.+?)(\&|\,),,gi and my $beginning = $1;

That should assign the bit before the first & or comma.

Hope that helps.

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!