Adding special characters to Python regex engine -


i have project searching bytecode instructions , expand allow use of regular expressions matching patterns.

the gist of want have custom character classes/sets can have such istore match of following instructions:

istore istore_0 istore_1 istore_2 istore_3

and similar iload ... iload_n etc.

istore , iload similar metacharacters \s stand multiple characters.

basically looking jumping off point can find way implement own metacharacters.

you don't need modify regex engine (which quite difficult)

you need helper function convert flavour of regex python's in same way use re.escape

def my_re_escape(regex):     regex = re.escape(regex)     regex = regex.replace('foo', 'bar')     # etc     return regex 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -