const regex = /(?=.*\{myVariable1\})(?=.*<html>)(?!.*<script>)/s;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?=.*\\{myVariable1\\})(?=.*<html>)(?!.*<script>)', 's')
const str = `Recycle Bin <scrippt>
Assigned to me 18 work items (1 selected)
ResultsEditorCharts Work item paneBottom
Save query
Column options {myVariable1}
Filter
IDWork Item TypeTitleStateRemaining WorkSeverityCreated Date705801Bug Ipad Tablet_PM Planning Labor Grid: Show Cost/Billing dropdown menu is overlapped by Plan Settings menu in PM workspace >> Planning Labor gridCommitted 38/24/2016 11:49:02 PM705969Bug Android Tablet_PM Planning Labor Grid: Columns displayed in Labor middle grid are overlappingCommitted 38/25/2016 4:56:55 AM705973Bug Android Tablet_PM Planning Labor Grid: Available Columns and Selected Columns grids are not displayed in Labor Grid SettingsCommitted 38/25/2016 5:08:06 AM712031Bug Column settings do not use the correct defaultsCommitted 39/14/2016 12:22:09 PM716142Bug Ipad Tablet_PM Plan/Project mode: List of Projects are not displayed properly in Project Result list dropdown menuCommitted 39/28/2016 2:06:17 AM707226Task Dev: Client - Remove Project Settings option and move individual settings to other placesDone 8/30/2016 4<html>35:35 PM619943Task Dev: Client - Actions popup menuDone 7/1/2016 2:03:11 PM693953Task dev:fix options above grid (PBI 612771)Done 7/26/2016 1:36:11 PM696198Task Dev: Changes to grid column selection dialog to support cost and billing views.Done 8/1/2016 1:37:43 PM699509Bug # selections above grid doesnt appear when paging is appliedIn Development 38/9/2016 12:46:11 PM699660Bug # selection doesn't show when "select All" checkbox is disabledIn Development `;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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