Hi,
What i am going to ask is very basic thing I know. But,as a newbie to
this platform,I am not getting the keen concept of backtracking in Regex
of Ruby. In such a case can any one help me to understand the core of
this concept by answering the following questions?
(a) What is backtracking?
(b) Why we need it?(means how regex with backtracking differs from a
regex without backtracking?)
(c) How it works when it is being used with any Regex? (It would be
great if it can be visualized with some code snippets to understand how
does it work)
(d) In what situation we have to think of it to use?
I used the link( Class: Regexp (Ruby 1.9.3) ) to get
it’s core,but my bad i am not getting the answers of all my above
questions from here to have the concept.
Thanks in advance!
On Fri, Jan 18, 2013 at 10:01 AM, Arup R. [email protected]
wrote:
(b) Why we need it?(means how regex with backtracking differs from a
it’s core,but my bad i am not getting the answers of all my above
questions from here to have the concept.
This freely-available chapter from Mastering regular expressions
talks about backtracking, although it doesn’t mention Ruby
specifically: http://oreilly.com/catalog/regex/chapter/ch04.html
Eric C. wrote in post #1094478:
On Fri, Jan 18, 2013 at 10:01 AM, Arup R. [email protected]
wrote:
(b) Why we need it?(means how regex with backtracking differs from a
it’s core,but my bad i am not getting the answers of all my above
questions from here to have the concept.
Can anyone help me to understand the concept with some codes? Code
examples always give us good visualization.
Thanks
On 1 Feb 2013, at 2:53 AM, Robert K. [email protected]
wrote:
Look into the regexp engines implementation. You won’t easily see how
the regexp engine works internally by only using it. Better yet, get
a copy of “Mastering Regular Expressions” and digest it.
This is very solid advice. It’s one of the references that you will use
for years beyond Ruby.
-a.
On Thu, Jan 31, 2013 at 8:05 PM, Arup R. [email protected]
wrote:
Eric C. wrote in post #1094478:
On Fri, Jan 18, 2013 at 10:01 AM, Arup R. [email protected]
wrote:
(b) Why we need it?(means how regex with backtracking differs from a
it’s core,but my bad i am not getting the answers of all my above
questions from here to have the concept.
Can anyone help me to understand the concept with some codes? Code
examples always give us good visualization.
Look into the regexp engines implementation. You won’t easily see how
the regexp engine works internally by only using it. Better yet, get
a copy of “Mastering Regular Expressions” and digest it.
Cheers
robert