Saludos foreros:
Alguien experto en expresiones regulares que me apoye a construir una que valide lo siguiente:
Ejemplo del texto a validar TEY-00063-24
Debe iniciar con las tres letras (TEY) siempre como constantes
Debe seguir un guion medio (TEY-)
Después deben ser 4 dígitos forzosos, del 0 al 9 (TEY.0063)
Después un guion medio (TEY.-0063-)
y finalmente dos dígitos forzosos del 0 al 9 (TEY-0063-24)
Gracias por sus respuestas
Expertos en expresiones regulares (SOLUCIONADO)
- Armando
- Posts: 3271
- Joined: Fri Oct 07, 2005 8:20 pm
- Location: Toluca, México
- Been thanked: 2 times
- Contact:
Expertos en expresiones regulares (SOLUCIONADO)
Last edited by Armando on Thu Mar 14, 2024 4:27 pm, edited 1 time in total.
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- VictorCasajuana
- Posts: 269
- Joined: Wed Mar 28, 2018 4:38 pm
- Location: Vinaròs
- Has thanked: 1 time
- Contact:
Re: Expertos en expresiones regulares
Respuesta de Copilot:
^TEY-\d{4}-\d{2}$
Enviado desde mi motorola edge 20 mediante Tapatalk
^TEY-\d{4}-\d{2}$
Enviado desde mi motorola edge 20 mediante Tapatalk
--------
¿ Y porque no ?
¿ And why not ?
¿ Y porque no ?
¿ And why not ?
- Antonio Linares
- Site Admin
- Posts: 42520
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
- Carles
- Posts: 1149
- Joined: Fri Feb 10, 2006 2:34 pm
- Location: Barcelona
- Been thanked: 7 times
- Contact:
Re: Expertos en expresiones regulares
Salutacions, saludos, regards
"...programar es fácil, hacer programas es difícil..."
UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
"...programar es fácil, hacer programas es difícil..."
UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
- Armando
- Posts: 3271
- Joined: Fri Oct 07, 2005 8:20 pm
- Location: Toluca, México
- Been thanked: 2 times
- Contact:
Re: Expertos en expresiones regulares
Foreros:
Gracias por sus sugerencias, pero en regex101.com (Gracias Carles) No match.
Saludos
Gracias por sus sugerencias, pero en regex101.com (Gracias Carles) No match.
Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- karinha
- Posts: 7935
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Expertos en expresiones regulares
Armando, mira se ayuda:
https://docs.netapp.com/us-en/oncommand ... example-14
https://www3.ntu.edu.sg/home/ehchua/pro ... egexe.html
http://www.hmgforum.com/viewtopic.php?t=3382
https://groups.google.com/g/harbour-use ... maL5eOBQAJ
Regards, saludos.
https://docs.netapp.com/us-en/oncommand ... example-14
https://www3.ntu.edu.sg/home/ehchua/pro ... egexe.html
http://www.hmgforum.com/viewtopic.php?t=3382
https://groups.google.com/g/harbour-use ... maL5eOBQAJ
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: Expertos en expresiones regulares
Suggestions works
Code: Select all | Expand
#include "fivewin.ch"
function main()
local oWnd
define window oWnd
activate window oWnd on init checkstring()
return nil
FUNCTION CheckString()
LOCAL cPattern := "^TEY-[0-9]{4}-[0-9]{2}$"
LOCAL cString := "TEY-1234-12" // "TEST"
IF HB_REGEXMATCH( cPattern, cString )
? "Pattern = ok."
ELSE
? "Pattern = Not ok. "
ENDIF
RETURN NIL
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
- Armando
- Posts: 3271
- Joined: Fri Oct 07, 2005 8:20 pm
- Location: Toluca, México
- Been thanked: 2 times
- Contact:
Re: Expertos en expresiones regulares
Amigos:
Ya todo va bien,
Muchas gracias a todos
Ya todo va bien,
Muchas gracias a todos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero