Home > front end >  Regex Expression to Identify Angular/Jquery library with version from source path
Regex Expression to Identify Angular/Jquery library with version from source path

Time:05-27

Could anyone assist me with Regex query to identify angular/jquery along with version from below set of samples.

For Example: From Sample "x_lsmcb_fm.jQuery_3.5.1.jsdbx" and "scripts/lib/jquery_includes.js", I would like to match first sample which contains jQuery and 3.5.1 as it contains both jQuery and version mentioned in the sample.

Samples:

x_lsmcb_fm.jQuery_3.5.1.jsdbx

scripts/lib/jquery_includes.js

scripts/lib/jquery_includes.js

scripts/lib/jquery_includes.js

angular_includes_1.4.jsx

scripts/lib/jquery_includes.js

angular_includes_1.4.jsx

scripts/lib/jquery_includes.js

x_lsmcb_fm.angular_1.8.0_min.jsdbx

scripts/lib/jquery_includes.js

scripts/lib/jquery_includes.js

scripts/lib/jquery_includes.js

angular_includes_1.4.jsx

x_73376_geofluent.Angular_1_4_framework.jsdbx

scripts/lib/jquery_includes.js

CodePudding user response:

You could try using the following regex:

.*j[qQ]uery_[\d\.] .*

Explanation:

  • .*: any combination of characters
  • j[qQ]uery: "j" either lower or upper "q" "uery"
  • _: underscore
  • [\d\.] : any combination of numbers and dots
  • .*: any combination of characters

Try it here.

CodePudding user response:

/((?=.angular|jquery|jQuery|Angular|angularjs|AngularJS|JQUERY)(?=.\d .\d )|(?=.angular|jquery|jQuery|Angular|angularjs|AngularJS|JQUERY)(?=.\d _\d )).*$/gm

  • Related