regex - python 3.4 regular expression windows registry -


i'm trying make regular expression return characters between last \ , closing ] .reg files

so far can work using no spaces in last key:

[hkey_local_machine\software\foo\bar\keypath]

using (?<=\\)(\w+)]

but can't handle spaces in last entry e.g:

[hkey_local_machine\software\foo\bar\key path]

i've many different keys , have 2 words while not. i'm still trying grips regular expressions.

maybe alternative:

(?<=\\)[^\\]+(?=]$) 

regex live here.

explaining:

(?<=\\)        # starting '\' without taking  [^\\]+         # character except '\' - many possible (?=]$)         # till ending ']' character - without taking 

hope helps.


Comments

Popular posts from this blog

c - Calling a function within a loop -

vb.net - Unbound DataGridView add row with checkbox error -

How i fill combobox items in Radgridview manually using in vb.net -