Article View: chile.comp.programacion
Article #741Re: Expresion Regular II
From: +mArkO+
Date: Fri, 19 Oct 2007 16:09
Date: Fri, 19 Oct 2007 16:09
61 lines
2299 bytes
2299 bytes
no soy muy entendido en el tema, pero podria ser: ([SNsn])([a-zA-Z0-9 ]+)\s([a-zA-Z0-9 ]*)(\r\n)*([\s\S]*) + =>1 � mas veces * =>o � mas veces "Pintamono" <pintamono@NoMandeWeas.kk> escribi� en el mensaje news:73a2d0f1f74ebfdede4c3cc14a267ce5$1@usenet.no-ip.com... > Tengo la siguiente expresion regular: > > ([SNsn])([a-zA-Z0-9 ]+)\s([a-zA-Z0-9 ]+)\r\n([\s\S]*) > > Esta expresion me acepta texto del tipo > > |S150 RTF3434 > 1 23 4 5 6 7 8 9 0 > > Y > |S150 RTF3434 > 1 23 4 5 6 7 8 9 0 > > Pero no me deja obviar el segundo campo de la primera linea, es decir... > > |S150 > 1 23 4 5 6 7 8 9 0 > > Esto no pasa. > > Considerando que el * es el comodin > > Probe con > > ([SNsn])([a-zA-Z0-9 ]+)\s*([a-zA-Z0-9 ]+)\r\n([\s\S]*) > ([SNsn])([a-zA-Z0-9 ]+)\s(*[a-zA-Z0-9 ]+)\r\n([\s\S]*) > ([SNsn])([a-zA-Z0-9 ]+)\s([a-zA-Z0-9 ]*+)\r\n([\s\S]*) > > Sin obtener resultados positivos... > > > Como puedo dejar la expresion para que el segundo campo aparezca 0 o 1 vez > solamente? > > Gracias!!! > > Nota: Lo que necesito es ingresar texto del tipo > > |S150 RTF1 > 1 avisos 23 4 5 6 7 8 9 0 > |S151 RtF2 > 2 avisos 23 4 5 6 7 8 9 0 > |S505 rtf3 > 3 avisos 23 4 5 6 7 8 9 0 > |S460 > 4 avisos 23 4 5 6 7 8 9 0 > |S200 ftr4 > 5 avisos 23 4 5 6 7 8 9 0 > |S800 ppp5 > 6 avisos 23 4 5 6 7 8 9 0 >
Technical Details
Message-ID:
<ffakrm$vdd$1@news.nivel5.cl>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!not-for-mailReferences:
<73a2d0f1f74ebfdede4c3cc14a267ce5$1@usenet.no-ip.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,8b91cd4b54ad36b9 X-Google-Attributes: gid1593cb,public,usenet X-Google-Language: SPANISH,ASCII Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!not-for-mail From: "+mArkO+" <kitim@porta.com> Newsgroups: chile.comp.programacion Subject: Re: Expresion Regular II Date: Fri, 19 Oct 2007 13:09:29 -0300 Organization: Varios Lines: 63 Message-ID: <ffakrm$vdd$1@news.nivel5.cl> References: <73a2d0f1f74ebfdede4c3cc14a267ce5$1@usenet.no-ip.com> NNTP-Posting-Host: pc-65-210-30-200.cm.vtr.net X-Trace: news.nivel5.cl 1192810167 32173 200.30.210.65 (19 Oct 2007 16:09:27 GMT) X-Complaints-To: news@news.nivel5.cl NNTP-Posting-Date: Fri, 19 Oct 2007 16:09:27 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-RFC2646: Format=Flowed; Original