[rt-users] CustomFieldValue - strip leading zeroes

Rob Munsch rob.munsch at gmail.com
Tue May 19 12:29:11 EDT 2009


On Tue, May 19, 2009 at 12:19 PM, Rob Munsch <rob.munsch at gmail.com> wrote:

> I'm trying to use s/^0*// in my CF template to strip out leading 0s from a
> 4 to 6 digit string.
>
> Some of them don't have leading 0s, some do; sometimes they are 4-6 digits
> and i need all of them; sometimes they are 6 digits with one or two leading
> zeroes i have to get rid of.
>
> using
> (s/^0*//([0-9]{4,6}))
>
> did not work,


Aha! never mind, i think.  The original expression, before i noticed the
leading zeroes, was looking for

TriggerText: 01234

using
FieldName|Body|(?i)triggertext\D?\D?\D?([0-9]{1,6})

because, iirc about setting that up, some people type TEXT 01234 and some
type TEXT: 01234, etc.  I'd forgotten i am not checking the beginning of the
*string,* just my $1 goal.

Now i'm using
(?i)vin\D?\D?\D?0*([0-9]{4,6})
which is a good deal simpler, and seems to be working. None, one, or a
million leading zeroes should be ignored now.

-- 
/chown -R us:us /yourbase
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090519/67996d23/attachment.htm>


More information about the rt-users mailing list