An Introduction to Inside the RegEx box

I happened to watch this below video which was explained with awesomeness.It is around an hour playing video. This guy has some magic really.

When you are start playing this video,

you will get started to hear surprises!!

Q1. What is regular expression?

Here I think you will get out :-( i was also

Regex is not a descriptive language of what we think..I don't what to think..anyway my perception went wrong.

So, Regex is just a code and blocks which has it's own dialect to execute the code/block/functions.This dialect is playing the role of virtual machine.The regex dialect has control flows, commands, exception handling.

Q2.What are the rules of regex engine?

Rules means the working mechanism what is follows. we have to understand it's rule.So, that will be helpful when spitting some matched result, you can wipe it without any whip.

The engine does when applying the pattern to the input string

  • The earliest possible substring is first than the Best possible string.
  • The pattern is always given preference to the leftmost/uppermost pattern among the others.

Q3. What regex dialect are we using generally?

PCRE (perl 5)

It is time to enter into the main picture.

The very very important things are coverd here is,

How is this engine works?

import re
re.findall('abc','abcdef')

They are introducing a concept called ‘BackTracking’ which is nothing but, if there is an exception or unmatched for first character of the string, the loop will be started again from the next character.The control will be started from initally for each character untill it found the match.

He is talking about execution model also.
* It will give you some amount of wonder if you listen carefully.
* Graph traversal is being done here.
* Also, NFA, DFA algorithms also used and explained with order of complexity.
* How minimal matching and Greed matching works?

Alert, Greed is always bad!! everywhere even in regex too. 🙂

(if you are doing greedy regexing(+, *) for 2gig file, your machine knows the pain)

backtracking raises, system falls

Unfortunately, I could not cover everything in detail here.I am sharing the video link.Hope you will enjoy and share the enjoyment 🙂

Click this:

hey, I am RegEx!!

Advertisements

About Navaneethan

mixed feelings...
This entry was posted in Academic, Python and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s