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

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -