bbnn
bbnn

Reputation: 3612

Vim search and replace reference on function call

How can I replace: for example PL SQL function call,

htp.formRadio('name', 'value', 'checked');

to be

<input type="radio" name="name" value="value" checked>

using vim search and replace regex?

Thank You

Upvotes: 0

Views: 384

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 754160

:s/htp.form\([A-Z][a-z]*\)('\([^']*\)', '\([^']*\)', '\([^']*\)');/<input type="\L\1\E" name="\2" value="\3" \4>/

Subject to not having made any typos. The pattern '\([^']*\)' is repeated and captures what's inside the quotes in the call.

Upvotes: 4

Related Questions