Page 1 of 1

RegEXP

Posted: Sat Jul 27, 2013 5:17 pm
by loulou
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

Re: RegEXP

Posted: Sat Jul 27, 2013 6:32 pm
by eddy
not a blank caracter
^(\S.+\S)$

not a space caracter
^([^ ].+[^ ])$

Re: RegEXP

Posted: Sat Jul 27, 2013 9:36 pm
by loulou
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

Re: RegEXP

Posted: Sat Jul 27, 2013 9:44 pm
by eddy
Try this:

Code: Select all

^(\S([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,70}\S)$

Re: RegEXP

Posted: Sat Jul 27, 2013 9:54 pm
by infratec
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

Re: RegEXP

Posted: Sat Jul 27, 2013 10:22 pm
by blueznl

Code: Select all

^[^ ].*[^ ]$