[ale] Regex question
Mike Murphy
mike at tyderia.net
Thu Mar 11 23:15:16 EST 2004
unless I'm missing something, something like this:
=~ /(XMI\d\d\d)/ should work. The entire string matched will show up in
$1 afteward. This presumes that not other characters will show in the
string.
Its also likely that
=~ /(XMI\d+)/ or even /(XMI/d*)/ would work too (the first would match 1
or more 'digits' the second would match 0 or more).
If you don't need to use $1 for anything, you can ditch the parens.
Mike
Chris Fowler wrote:
> I need to do a match using perl regex. Here is the possible strings
> that will be in a stream:
>
> XMI
> XMI001
> XMI002
> XMI###
>
> Were the '#' could be any number. I need to be able to detect that
> the above pattern matches in a chunk of data. What is the correct
> regex that will fit that pattern?
>
> Thanks,
> Chris
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
--
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mike Murphy
781 Inman Mews Drive Atlanta GA 30307
Landline: 404-653-1070
Mobile: 404-545-6234
Email: mike at tyderia.net
Email Pager: pagemike at tyderia.net
AIM: mmichael453
JDAM: 33:45:14.0584N 84:21:43.038W
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
More information about the Ale
mailing list