const regex = /^(?=.*px\;)([ \S]*)/gmi;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^(?=.*px\\;)([ \\S]*)', 'gmi')
const str = `.inpt-line {
position: relative;
display: block;
min-height: 56px;
width: 660px;
box-sizing: border-box;
padding: 20px 20px 5px 20px;
color: #787373;
}
.inpt-line label {
font-size: 22px;
font-weight: bold;
text-align: right;
width: 250px;
height: 50px;
}
.inpt-line input,
.inpt-line select {
position: relative;
top: -3px;
height: 30px;
width: 235px;
font-size: 18px;
padding-left: 10px;
box-sizing: border-box;
margin: 0px 15px 5px 10px;
}
input[type="number"] {
width: 80px
}
`;
const subst = `$1`;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions