Regular Expressions 101

Community Library

Community Library Entry

0

Regular ExpressionOpen Workspace

/
(?<=--path[ |=])dist\/.*(?=$)
/
gm

Description
Created·2022-03-11 21:05
Type·Match
Flavor·JavaScript

Ideally, to be used with JS Array join and String replace methods, like so:

process.argv.join(' ').replace(/["']/g, '').match(/(?<=--path[ |=])dist\/.*(?=$)/);

The join is to convert array to string to prevent iterating. The replace is to remove single or double quotes for easier matching. The 'dist' folder is a safeguard to prevent matching anything outside of that folder.

Submitted by Marc Kassay
Open Workspace