This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes regex Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "regex" Watch "regex" New topic
Author

regex

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


OUTPUT:

Match number 1
start(): 0
end(): 3
Match number 2
start(): 4
end(): 7
Match number 3
start(): 8
end(): 11

i don't understand how is it working

what i understand regx says match substring where "spacedogspace " i think there is only one match should be found at index 3.


My one regret in life is that I am not someone else.
- Woody Allen
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41128
    
  45
Where do you think you're specifying the "space" before and after the word? Have you read the javadocs of the java.util.regex.Pattern class to learn what all the regexp options and special characters mean?


Ping & DNS - my free Android networking tools app
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Ulf Dittmer wrote:Where do you think you're specifying the "space" before and after the word? Have you read the javadocs of the java.util.regex.Pattern class to learn what all the regexp options and special characters mean?


Thanks, there was some confusion ,after reading i got that i thought \\b is for escape sequence backspace.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: regex
 
Similar Threads
Regex question
Pattern Matching
replacement through regex
Please help me check this regex
Hot to deal with OutOfMemoryError