Unable to understand the way of trimming white spaces in regex in a line from start to end using regex -


i'm new regex.i'm trying understand concept of trimming white spaces in line.in process came across snippet

below given example: http://regexone.com/example/5

the question has got solution well

 ^\s*([\w\s.]*)\s*$ 

however..i finding hard understand this.let me explain understanding till now

 ^   - starting of line \s*  - whitespace [\w\s.]*- combination of word character , white space character??(zero            or more times??)(have not understood properly)  \s*  -again whitespace character(zero or more times?)  $   -end of line 

i able understand syntax couldnot understand it's complete sense.any highly appreciated.

that looks right. try clarify

 ^       - start of line \s       - single whitespace character (space or tab or line return) *        - 0 or more of previous item \s*      - 0 or more whitespace characters []       - character class. matches of characters or groups of characters            contained [\w\s.]  - matches word character, whitespace character or period ('.') [\w\s.]* - matches 0 or more of above  $       - end of line 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -