Regex, lookBehind or lookAhead? -


my 2 regular expressions:

( |\t)+(?!"n)[\:a-za-z0-9,\"\[\]\}\{]+ ( |\t)+(?!"name": ".+)[\:a-za-z0-9,\"\[\]\}\{]+ 

both keep (yes, first one):

    "name": 

see http://regexr.com/3gnmu

i'm trying hours keep (select other lines):

    "name": "animated",     "name": "controlled", 

or @ least

    "animated"      "controlled"  

where "name" present, using lookahead , lookbehind (notepad++, not javascript) in:

          "end": {             "line": 3,             "column": 17           }         },         "range": [           71,           79         ],         "name": "animated",         "typeannotation": null,         "optional": false       },         "name": "controlled",         "typeannotation": null,         "optional": false       }, 

i'm surprised downvoters beating 35 "reputation" points (now 27).

i found solution , i'm not bitter enough keep me :

((.+?\n)+?((  )+?"name": ".+?").+?\n)|(?!"name).+ 

replaced by

$3\n 

regexr link updated.

btw, "name" lines @ different "child" levels in json , needed keep them (using spaces).

i wonder how parse same result. i'm open new tools , learn something. feel free comment add link , explain how isolate "name" value in different levels using json parser.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -