English
Forum

RegEx

 
- Page 1 -



Michael
W.
somehow be I with the Umdefinieren the Ersatzzeichens into regulären squeeze out not so happy.

it would beautiful if The expressions so written go could, How everywhere differently too...

get this not to that walk...
CompileMarkSeparation
' maskierte Werte testen

Proc IsOk

    Parameters x%
    Return if(x%,"OK","nicht OK")

EndProc

Proc IsMask1'Datum

    ' erlaube nur "dd.mm.yyyy" (als Trenner aber "-","/",".")
    ' ungültiges Datum (z.B. 31.02.1999) wird nicht erkannt
    Parameters TestWert$
    var re$ = "([1-9]|[ 0][1-9]|[12][0-9]|3[01])[-/.](0[1-9]|1[012])[-/.](18|19|20|21)[0-9]{2}"
    Return if(match$(re$,TestWert$),1,0)

EndProc

Proc IsMask2'email

    ' EMail nach RFC 2822 (mit einigen speziellen TLDs)
    ' zum Testen auch eine super simple....
    Parameters TestWert$
    /*
    'ori:  [a-z0-9!#$%&'*+/=?^_'{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_'{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|asia|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel)\b
    var re$ = "(?i)[a-z0-9!#$%&'*+/=?^_'{|}~~-]+(~.[a-z0-9!#$%&'*+/=?^_'{|}~~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?~.)+([A-Z]{2}|asia|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel)~b"
    */
    'TEST
    'ori:  \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}\b
    var re$ = "(?i)~b[A-Z0-9._%+-]+@[A-Z0-9.-]+~.[A-Z]{2,6}~b"
    'TEST
    Return if(match$(re$,TestWert$),1,0)

EndProc

cls
print "Masken testen\n"
Declare Test$
Print "Datum"
Test$ = "1.12.1999"
Print Test$;tab(15);IsOk(IsMask1(Test$))
Test$ = "25-12-2007"
Print Test$;tab(15);IsOk(IsMask1(Test$))
Test$ = "12-25-2007"
Print Test$;tab(15);IsOk(IsMask1(Test$))
Test$ = "/12/1999"
Print Test$;tab(15);IsOk(IsMask1(Test$))
Print "\nEMail"
Test$ = "john@aol...com"
Print Test$
Case IsMask2(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask2(Test$))
Test$ = "Mike\\ O'Dell@ireland.com"
Print Test$
Case IsMask2(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask2(Test$))
Test$ = "The email address president@whitehouse.gov is valid."
Print Test$
Case IsMask2(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask2(Test$))
waitinput
 href='./../../Function-References/XProfan/end/'>end
 
XProfan X3
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
12/16/14  
 



« this Posting watts as Solution marked. »


Michael
W.
i'm of course still over the Ersatzzeichen unhappy, but the "simple" Error is enttarnt...
CompileMarkSeparation
' maskierte Werte testen
' (lauffähig)

Proc IsOk

    Parameters x%
    Return if(x%,"OK","nicht OK")

EndProc

Proc IsMask1'Datum

    ' erlaube nur "dd.mm.yyyy" (als Trenner aber "-","/",".")
    ' ungültiges Datum (z.B. 31.02.1999) wird nicht erkannt
    Parameters TestWert$
    var re$ = "([1-9]|[ 0][1-9]|[12][0-9]|3[01])[-/.](0[1-9]|1[012])[-/.](18|19|20|21)[0-9]{2}"
    Return if(match$(re$,TestWert$)<>"",1,0)

EndProc

Proc IsMask2'email

    ' EMail super simple....
    Parameters TestWert$
    'ori:  \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}\b
    var re$ = "(?i)~b[A-Z0-9._%+-]+@[A-Z0-9.-]+~.[A-Z]{2,6}~b"
    Return if(match$(re$,TestWert$)<>"",1,0)

EndProc

Proc IsMask3'email

    ' EMail nach RFC 2822 (mit einigen speziellen TLDs)
    Parameters TestWert$
    'ori:  [a-z0-9!#$%&'*+/=?^_'{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_'{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|asia|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel)\b
    var re$ = "(?i)[a-z0-9!#$%&'*+/=?^_'{|}~~-]+(~.[a-z0-9!#$%&'*+/=?^_'{|}~~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?~.)+([A-Z]{2}|asia|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel)~b"
    Return if(match$(re$,TestWert$)<>"",1,0)

EndProc

cls
print "Masken testen\n"
Declare Test$
Print "Datum"
Test$ = "1.12.1999"
Print Test$;tab(15);IsOk(IsMask1(Test$))
Test$ = "25-12-2007"
Print Test$;tab(15);IsOk(IsMask1(Test$))
Test$ = "12-25-2007"
Print Test$;tab(15);IsOk(IsMask1(Test$))
Test$ = "/12/1999"
Print Test$;tab(15);IsOk(IsMask1(Test$))
Print "\nEMail simpel"
Test$ = "john@aol...com"
Print Test$
Case IsMask2(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask2(Test$))
Test$ = "Mike\\ O'Dell@ireland.com"
Print Test$
Case IsMask2(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask2(Test$))
Test$ = "The email address president@whitehouse.gov is valid."
Print Test$
Case IsMask2(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask2(Test$))
Print "\nEMail RFC 2822"
Test$ = "john@aol...com"
Print Test$
Case IsMask3(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask3(Test$))
Test$ = "Mike\\ O'Dell@ireland.com"
Print Test$
Case IsMask3(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask3(Test$))
Test$ = "The email address president@whitehouse.gov is valid."
Print Test$
Case IsMask3(Test$) : Print "  ";$Match
Print "  ";IsOk(IsMask3(Test$))
wa
t end
 
XProfan X3
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
12/16/14  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.820 Views

Untitledvor 0 min.
Erhard Wirth06/14/24
H.Brill12/07/23
Michael W.07/31/17
maroro03/15/16
More...

Themeninformationen

this Topic has 1 subscriber:

Michael W. (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie