VSCode regex find and select data from specific group (not replace)

Multi tool use
Multi tool use


VSCode regex find and select data from specific group (not replace)



Consider the following dataset:


<uses-configuration
android:reqFiveWayNav=["true" | "false"]
android:reqHardKeyboard=["true" | "false"]
android:reqKeyboardType=["undefined" | "nokeys" | "qwerty" | "twelvekey"]
android:reqNavigation=["undefined" | "nonav" | "dpad" | "trackball" | "wheel"]
android:reqTouchScreen=["undefined" | "notouch" | "stylus" | "finger"] />



I am trying to select all the values after android:
In order to do this, i am using (aw+:)(w+) which does exactly what i want. I know that I can use the search and replace and use$2 to select the second group, but I dont want to replace anythin. I want to select anything the second group matches with alt+enter key press.


android:


(aw+:)(w+)


$2


alt+enter



Is this possible?




1 Answer
1



What you really need is a lookaround. I don't believe that vscode supports lookbehinds (see issues: lookbehind support coming). But it does support lookaheads so :


(w+)(?==[.*])



should work for you as long as your desired values are followed by "[.*]" and nothing undesired has that pattern. The lookahead part will not be selected by vscode. And then Alt-Enter selects all the matches.


[.*]



If lookbehind was supported, maybe soon, this would work:


(?<=aw+:)(w+)






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

QwJ2v,astTTyH7yAv C 4iPd6IaDlogy1LswPB,cVD9mgh,YfdyWxG3B sgbdGF,O,t0iq 0ovP,xkc
r3HlPUrsygcBk Vr qj l7C9s VP4a3 p1jzpRl,sVixgg,Iz,iir 42AEO,FGM2LZWcVX MrsCND V w51CwhV2iAd1d L

Popular posts from this blog

Boo (programming language)

Rothschild family