RegEXP

Just starting out? Need help? Post your questions and find answers here.
loulou
User
User
Posts: 38
Joined: Tue Dec 08, 2009 7:42 am

RegEXP

Post 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
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: RegEXP

Post by eddy »

not a blank caracter
^(\S.+\S)$

not a space caracter
^([^ ].+[^ ])$
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
loulou
User
User
Posts: 38
Joined: Tue Dec 08, 2009 7:42 am

Re: RegEXP

Post 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
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: RegEXP

Post by eddy »

Try this:

Code: Select all

^(\S([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,70}\S)$
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: RegEXP

Post 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
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: RegEXP

Post by blueznl »

Code: Select all

^[^ ].*[^ ]$
( 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... )
Post Reply