Just starting out? Need help? Post your questions and find answers here.
loulou
User
Posts: 38 Joined: Tue Dec 08, 2009 7:42 am
Post
by loulou » Sat Jul 27, 2013 5:17 pm
Who can help me ?
I want to control that the first character of a sting is not a space and the last character is not a space
How can i do with regexep exclusively
Here is my regexpe that's don't work
Code: Select all
"^(\S(([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,70}))^(\s)"
Thanks to help me
eddy
Addict
Posts: 1479 Joined: Mon May 26, 2003 3:07 pm
Location: Nantes
Post
by eddy » Sat Jul 27, 2013 6:32 pm
not a blank caracter
^(\S.+\S)$
not a space caracter
^([^ ].+[^ ])$
win10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
loulou
User
Posts: 38 Joined: Tue Dec 08, 2009 7:42 am
Post
by loulou » Sat Jul 27, 2013 9:36 pm
now i arrive to test if at the beginningof the Sentence it's a space but i don'tarrive for then end of the space
Code: Select all
"^(\S([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,70})"
This regular expression is for a restriction in an XSD
eddy
Addict
Posts: 1479 Joined: Mon May 26, 2003 3:07 pm
Location: Nantes
Post
by eddy » Sat Jul 27, 2013 9:44 pm
Try this:
Code: Select all
^(\S([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,70}\S)$
win10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
infratec
Always Here
Posts: 7577 Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany
Post
by infratec » Sat Jul 27, 2013 9:54 pm
Try this:
Code: Select all
If CreateRegularExpression(0, "(^\s.+\s$)")
Debug "Success"
Debug MatchRegularExpression(0, " abC ")
Debug MatchRegularExpression(0, " abC")
Debug MatchRegularExpression(0, "abC ")
Else
Debug RegularExpressionError()
EndIf
Bernd
blueznl
PureBasic Expert
Posts: 6166 Joined: Sat May 17, 2003 11:31 am
Contact:
Post
by blueznl » Sat Jul 27, 2013 10:22 pm
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide
right here ... )