regular expression pattern andmatcher

Hi,

What are main scenarios we use regular expresssions. what are the practical uses of them.

why we need Patter and Matcher classes used there and start(), find(), group(), compile(), matcher() methods.

Please advise
LVL 7
gudii9Asked:
Who is Participating?
 
ozoCommented:
"Regular" expressions with back references can match more than just regular languages, they are NP-complete.
And recursive regular expression substitution is Turing complete, so you do a lot with them.

You need Patter and Matcher classes because you are using the standard Java regex library, and start(), find(), group(), compile(), matcher() are the methods implemented by that library.
0
 
ozoCommented:
But they are more commonly used for simple text manipulation.
Very simple text manipulation might be done more easily with more generic and less powerful tools.
Very complicated text manipulation might be done more efficiently with more specialized tools.
Somewhere in the middle, or of there are many related text manipulation tasks that can all be done by adjusting a single regular expression, regular expressions can be the tool of choice.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.