have u tried using firefox addon "Regular Expression Tester". you can test
those expressions on sample texts and see if it captures what you want to
capture..

On Thu, Jun 12, 2008 at 4:52 PM, Glennix glennix <[EMAIL PROTECTED]>
wrote:

> i suppose u'r doing it on perl?
> how about something like this one
>
> #!/path/to/perl
>
> $text="This is a TXT123 and TXT123-123  and this is a TXT123-123GT";
> @xxx=split(' ', $text);
> foreach $el (@axxx) {
>         if ($el =~ /[A-Z]+[0-9]+[\-0-9]+[^A-Z]+/ && $' !~ /[A-Z]/) {
>                         print $el." matched\n";
>         }
> }
>
> --- On *Thu, 6/12/08, Noli Rafallo <[EMAIL PROTECTED]>* wrote:
>
> From: Noli Rafallo <[EMAIL PROTECTED]>
> Subject: Re: [plug] Regex Help
> To: "'Philippine Linux Users' Group (PLUG) Technical Discussion List'" <
> [email protected]>
> Date: Thursday, June 12, 2008, 2:34 PM
>
>
> I guess I haven't stated my question clearly, my fault. Though your sample
> pattern matches both sample expression, it also matches expression such as
> ABC123-123asdf. I still learned something though from the sample in addition
> to the book I am reading.
>
> Thank you Sir.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Zak B. Elep
> Sent: Thursday, June 12, 2008 1:31 PM
> To: Philippine Linux Users' Group (PLUG) Technical Discussion List
> Subject: Re: [plug] Regex Help
>
> On Thu, Jun 12, 2008 at 12:59 PM, Noli Rafallo <[EMAIL PROTECTED]>
> wrote:
> > I am trying to create
>  a single regular expression that will match texts
> like
> > ABC123 or ABC12-12. I have this (^[a-z]{1,3}[0-9]{1,3}$) which works with
> > the first text but I don't know yet how to handle the second text with
> a
> > dash in it.
>
> How about '^[A-Z]{1,3}[\-0-9]+'?
>
> --
> Zak B. Elep || http://zakame.spunge.org
> [EMAIL PROTECTED] || [EMAIL PROTECTED] || [EMAIL PROTECTED]
> 1486 7957 454D E529 E4F1 F75E 5787 B1FD FA53 851D
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph
>
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph
>
>
>
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph
>
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to