in Education by
The context is that I am copy pasting React props definition into the function arguments, so that I don't have to type the variable names one by one: // Select these 3 lines with V3j MyComponent.propTypes = { formName: PropTypes.string.isRequired, formPurpose: PropTypes.string.isRequired, formPlaceholder: PropTypes.string.isRequired, }; To remove the : PropTypes.string.isRequired and change it to ={variableNameHere} I'm using the following Vim regex: :'<,'>s/\(.*\)\zs:.*/={\1}/g This should capture the variable name, remove everything after : and put the capture inside the curly brackets on ={}. The result is the following: formName={ formName} formPurpose={ formPurpose} formPlaceholder={ formPlaceholder} There's an unwanted space after { and I can't figure out what is that space in the regex. Any ideas? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Use :'<,'>s/[[:blank:]]*\(.*\)\zs:.*/={\1}/g The spaces you get are the leading spaces before your expression.

Related questions

0 votes
    I have a data which looks like EX:992215:SHOW:CMS016:000335:ESP:15:EUR:Euro:4:14:01/05/2009 :30 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have a data which looks like EX:992215:SHOW:CMS016:000335:ESP:15:EUR:Euro:4:14:01/05/2009 :30 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have a data which looks like EX:992215:SHOW:CMS016:000335:ESP:15:EUR:Euro:4:14:01/05/2009 :30 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    How do I do a regexp search against a Mandarin string? JavaScript questions and answers, JavaScript questions ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I simply can't figure this out and have been trying for awhile. I need a regex that will parse ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I simply can't figure this out and have been trying for awhile. I need a regex that will parse ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I simply can't figure this out and have been trying for awhile. I need a regex that will parse ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    _________ is an attack which forces an end user to execute unwanted actions on a web application in which ... , Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    Which component do you need in order to prevent an unwanted commit in MySQL database? tMysqlRollback tMysqlCommit tMysqlLookupInput tMysqlRow...
asked Mar 25, 2021 in Technology by JackTerrance
0 votes
    From a group of 3 boys and 2 girls, we select two children. What would be the sample space for this experiment ? Select the correct answer from above options...
asked Nov 15, 2021 in Education by JackTerrance
0 votes
    An individual has O' blood group if his/her blood sample (a) clumps only when antiserum A ... Science,Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 8, 2021 in Education by JackTerrance
0 votes
    Once _____________ hijacks your system, it might perform different sorts of unwanted tasks. (a) Server hacking ... -Cyber Security:,Cyber Security-Jobs:,Cyber Security Applications...
asked Oct 31, 2021 in Education by JackTerrance
0 votes
    An instar can respond to a set of input vectors even if its not trained to capture the behaviour of the ... Neural Networks of Neural Networks Please answer the above question....
asked Aug 27, 2022 in Education by JackTerrance
0 votes
    Give one example each of ( a ) α − ( emission, ( b ) β c − − ( emission, and ( c ) K − ... Write an equation for these nuclear changes. Select the correct answer from above options...
asked Jan 2, 2022 in Education by JackTerrance
...