Kaviraj       Archive       Tags

Emacs: Split window with different buffer

It’s common to split windows while working in emacs. By default, whenever we split windows in emacs the newly created window will also have the same buffer(same buffer in two windows). So it is always needed to change to another buffer by C-x b after splitting it.

We can customize it by little elisp code as below.

Read More

#elisp #emacs

Understanding regular expression parsing

I was reading a wonderfull article on python regular expression. And I was playing with some example code.

import re

text = "aabbbaaababaab"
pattern = "abb"

re.findall(pattern, text)
# output: ['abb']
# pattern 'abb' found at index 1:3

then I got stuck with following code. I couldn’t understand why the output is the way it is.

import re

text = "aabbbaaababaab"
pattern = "ab+" # a followed by one or more b

re.findall(pattern, text)
# output: ['abbb', 'ab', 'ab', 'ab']
# wait.. Where is "abb"?

Read More

#python #regular-expression